Support AnimatedImage on watchOS - Using WatchKit bridge #22
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.