SDWebImage / SDWebImageSwiftUI

SwiftUI Image loading and Animation framework powered by SDWebImage
https://sdwebimage.github.io/SDWebImageSwiftUI
MIT License
2.21k stars 230 forks source link

Issue with private API (AnimatedImage) #64

Closed tiepvuvan closed 4 years ago

tiepvuvan commented 4 years ago

We're trying to upload binary to AppStoreConnect, but we got this error, seem like we should remove the private API of AnimatedImage

Screen Shot 2019-11-29 at 18 23 46
dreampiggy commented 4 years ago

Sounds reasonable. The only way to resolve this, it's to drop the WatchKit animation support :(

dreampiggy commented 4 years ago

I'm working on #43 and replace this implementation.

The old WatchKit is suck on the animation, which Apple itself use UIKit method to build the system App, but you can not and have to suck at Storyboard (which disable the dynamic create of View). Nobody can implement the animated image using WatchKit, without private API.

SwiftUI is the actually only public Native UI framework for watchOS.

dreampiggy commented 4 years ago

@tiepvuvan It's done.

Now, from v0.9.0, if you really want to use Animated Image on watchOS, you should use WebImage instead, with the new public func animated(_ animated: Bool = true) -> WebImage API

WebImage(url: URL(string:url))
.resizable()
.animated()
.animation(.easeInOut(duration: 0.5))
.transition(.fade)
.scaledToFit()

It's a SwiftUI view (not UIViewRepresentable), without any hack. But currently, because of SwiftUI's layout system and rendering system, the performance may be a little slower than the SDAnimatedImageView (our current AnimatedImage UIView implementation).

But this is the best compatible components for SwiftUI. Which use all the SwiftUI lifecycle. After I release the new version, you can have a try with that.

dreampiggy commented 4 years ago

@tiepvuvan Use v0.9.0 and new WebImage instead.