-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
migrate to preloadAllAnimationData #664
Conversation
`pod install` resulted in automated project updates
All instances of `preloadAllGIFData` are now `preloadAllAnimationData` with proper @available notices
@onevcat Please note that the initial
All Tests on my machine completes with no errors.
|
Thanks! |
Worked.
|
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.
LGTM. Added several comments, please review them. We could merge it once things get done & CI passed.
Thanks!
Sources/KingfisherOptionsInfo.swift
Outdated
public var preloadAllGIFData: Bool { | ||
return contains { $0 <== .preloadAllGIFData } | ||
return contains { $0 <== .preloadAllAnimationData } |
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.
Maybe we could just return preloadAllAnimationData
?
Sources/Image.swift
Outdated
return image | ||
} | ||
|
||
@available(*, deprecated, message: "preloadAllGIFData is now preloadAllAnimationData") |
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.
Since it is an internal API, we could just remove it instead of marking it as deprecated.
Sources/KingfisherOptionsInfo.swift
Outdated
case preloadAllAnimationData | ||
|
||
/// Back compatibility for deprecated preloadAllGIFData | ||
@available(*, deprecated, renamed: "preloadAllAnimation") |
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.
Could you move the deprecated
statements to an extra extension at the end of this file (like what is done here)?
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.
The difference here it's a enum and not functions. But I'll fix the other ones as requested.
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.
It should be fine to have this static property in an extension (as long as the extension is public
, it should also supply good back compatibility).
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.
I don't understand how you suggest having the enum value deprecated outside of the enum declaration (Swift AFAIK does not support adding to an enum through inheritance or any other extension mechanism)
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.
Here you are using a static property to "simulate" the syntax of an enum case:
@available(*, deprecated, renamed: "preloadAllAnimation")
static let preloadAllGIFData = KingfisherOptionsInfoItem.preloadAllAnimationData
So it is possible to move it to extension (it is not an enum member anymore). Sure you could keep it as an enum member (in which case you cannot move it to an extension), but I think it is a clever way to make it a static property here.
In there, this should also compile:
public extension KingfisherOptionsInfoItem {
@available(*, deprecated, renamed: "preloadAllAnimation")
static let preloadAllGIFData = KingfisherOptionsInfoItem.preloadAllAnimationData
}
And users could get a rename warning if it is used.
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.
Tried the same, but with incorrect syntax is seems... Thanks 👍
Oops, didn't notice it. It should since the release script runs without issue. I guess it might be a CocoaPods issue.
Sure. I'll release 3.7.1 once it prepared. |
48aa054
to
9dbbab3
Compare
Sources/KingfisherOptionsInfo.swift
Outdated
@available(*, deprecated, renamed: "preloadAllAnimation") | ||
public var preloadAllGIFData: KingfisherOptionsInfoItem { | ||
return .preloadAllAnimationData | ||
} |
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.
This should return a Bool
with implementation like this:
@available(*, deprecated, renamed: "preloadAllAnimation")
public var preloadAllGIFData: Bool {
return preloadAllAnimationData
}
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.
My bad a typo of copy & paste.
Fixed
Great. I added another comment. Please fix that too before we could finally merge it. |
9dbbab3
to
63c4bac
Compare
migrate to preloadAllAnimationData
Rename all instances of
preloadAllGIFData
topreloadAllAnimationData
with proper @available notices.References #663