-
Notifications
You must be signed in to change notification settings - Fork 242
Support AnimatedImage on watchOS - Using WatchKit bridge #22
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ill contains small issues
… that cause WKInterfaceImage not dealloc
…ctive-C and Swift code, really suck, Apple :)
This PR, actually, show all the current Swift, SwiftPM and SwiftUI's pain and bugs. To say, this is a good experiment, which show How hard it is for user to write a framework like Apple, which contains real world code and edge cases.
.target(
name: "SDWebImageSwiftUI",
dependencies: ["SDWebImage", "SDWebImageSwiftUIObjC"],
path: "SDWebImageSwiftUI/Classes",
exclude: ["ObjC"]
),
// This is implementation detail because SwiftPM does not support mixed Objective-C/Swift code, don't dependent this target
.target(
name: "SDWebImageSwiftUIObjC",
dependencies: ["SDWebImage"],
path: "SDWebImageSwiftUI/Classes/ObjC",
sources: ["SDAnimatedImageInterface.h", "SDAnimatedImageInterface.m"],
publicHeadersPath: "."
)
|
4cdcbe8
to
7563ccd
Compare
…works on Objective-C code import syntax, but works on Xcode
7563ccd
to
2e9af2f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This feature implements the
AnimatedImage
view on watchOS via SwiftUI.The implementation is based on a implementation of
SDAnimatedImageInterface
, which subclass theWKInterfaceImage
(which Apple's documentation does not recommend). This is the temporary solution to fit our usage and because of the hack, this may not be compatible for future watchOS 7 release.See my tweet about this: https://twitter.com/DreamingPiggy/status/1185582862583488514
In long term, the Native UIView bridge is not a general solution. In the future, when SDWebImage this PR is ready: SDWebImage/SDWebImage#2861
The SwifUI port will use native
Image
struct with Animated Player, to refresh and render each frames, which may be better than current solution.