-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Feature nsbutton webcache #2183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature nsbutton webcache #2183
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2183 +/- ##
==========================================
+ Coverage 78.7% 78.72% +0.02%
==========================================
Files 36 36
Lines 3620 3624 +4
Branches 322 322
==========================================
+ Hits 2849 2853 +4
Misses 749 749
Partials 22 22
Continue to review full report at Codecov.
|
This is great. But I'm just curious does anyone really need this feature right now? I'm not a AppKit guy myself. |
@skyline75489 Actually we have some macOS users. I introduce this because this is easy to integrate and have no bad effect on current Core API (Or I'll not consider to change). I think this can be useful unless you receive from the feature request from user. I'm also considering a better way in the future to support Many feature maybe we do not use, but since SD become more porpular cross the platform(iOS/macOS/tvOS/watchOS). I think we should always provide some convenient API for the specify platform instead of just focus on iOS. |
8f0dcf1
to
7996b0d
Compare
…tle code refactoring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though i am not an AppKit coder myself the logic behind this PR valid.
- (SDStateImageURLDictionary *)imageURLStorage { | ||
#pragma mark - Private | ||
|
||
- (SDStateImageURLDictionary *)sd_imageURLStorage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this to sd_imageURLStorage
because write any category method is actually in the class method list during runtime. So this may cause name conflict. Seems not current, but have this possibility :)
New Pull Request Checklist
I have read and understood the CONTRIBUTING guide
I have read the Documentation
I have searched for a similar pull request in the project and found none
I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
I have added the required tests to prove the fix/feature I am adding
I have updated the documentation (if necessary)
I have run the tests and they pass
I have run the lint and it passes (
pod lib lint
)This merge request fixes / reffers to the following issues: ...
Pull Request Description
This PR add a WebCache category for
NSButton
on macOS.The
NSButton
's design is quite different fromUIButton
, which based on itsNSButtonCell
and the image for rendering is based on by two properties calledstate
andtype
. See SettingButtonImageIn fact, this means there is not a
key-value pair
for[UIControlState : UIImage]
like in UIKit. So if we use#define NSButton UIButton
will cause many issue(For example, theforState
arg is totally unused forNSButton
). So we'd better seperate to create a new category instead.Thanks to that
UIView+WebCache
and now we just need to copy-paste the interface and write two lines code, a new WebCache view category can be done easily without touching any Core API.I update the macOS demo to provide a little button to clear the cache. That works great :)