Skip to content

Commit e47153c

Browse files
committed
Add the readme about the AnimatedImage's API which share the same naming as SwiftUI View
1 parent 5473784 commit e47153c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@ var body: some View {
178178

179179
Note: `AnimatedImage` supports both image url or image data for animated image format. Which use the SDWebImage's [Animated ImageView](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) for internal implementation. Pay attention that since this base on UIKit/AppKit representable, some advanced SwiftUI layout and animation system may not work as expected. You may need UIKit/AppKit and Core Animation to modify the native view.
180180

181+
Note: `AnimatedImage` some methods like `.transition`, `.indicator` and `.aspectRatio` have the same naming as `SwiftUI.View` protocol methods. But the args receive the different type. This is because `AnimatedImage` supports to be used with UIKit/AppKit component and animation. If you find ambiguity, use full type declaration instead of the dot expression syntax.
182+
183+
```swift
184+
AnimatedImage(name: "animation2") // Just for showcase, don't mix them at the same time
185+
.indicator(SDWebImageProgressIndicator.default) // UIKit indicator component
186+
.indicator(Indicator.progress) // SwiftUI indicator component
187+
.transition(SDWebImageTransition.flipFromLeft) // UIKit animation transition
188+
.transition(AnyTransition.flipFromLeft) // SwiftUI animation transition
189+
```
190+
181191
### Which View to choose
182192

183193
Why we have two different View types here, is because of current SwiftUI limit. But we're aimed to provide best solution for all use cases.

0 commit comments

Comments
 (0)