Skip to content

Commit 91f81c5

Browse files
committed
Update the documentation about the WebImage animation support
1 parent 6e5f180 commit 91f81c5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Besides all these features, we do optimization for SwiftUI, like Binding, View M
3333

3434
This framework is under heavily development, it's recommended to use [the latest release](https://github.com/SDWebImage/SDWebImageSwiftUI/releases) as much as possible (including SDWebImage dependency).
3535

36-
Note we do not guarantee the public API stable for current status until v1.0 version, to follow [Semantic Versioning](https://semver.org/).
36+
Note we do not guarantee the public API stable for current status until v1.0 version (released soon in February), to follow [Semantic Versioning](https://semver.org/).
3737

3838
All issue reports, feature requests, contributions, and GitHub stars are welcomed. Hope for active feedback and promotion if you find this framework useful.
3939

@@ -100,7 +100,6 @@ var body: some View {
100100
.placeholder {
101101
Rectangle().foregroundColor(.gray)
102102
}
103-
.animated() // Supports Animated Image
104103
.indicator(.activity) // Activity Indicator
105104
.animation(.easeInOut(duration: 0.5)) // Animation Duration
106105
.transition(.fade) // Fade Transition
@@ -111,7 +110,16 @@ var body: some View {
111110

112111
Note: This `WebImage` using `Image` for internal implementation, which is the best compatible for SwiftUI layout and animation system. In previous version, `WebImage` supports static image format only, because unlike `UIImageView` in UIKit, SwiftUI's `Image` does not support animated image or vector image.
113112

114-
Note: From v0.9.0, `WebImage` supports animated image as well! You can use `.animated()` to start animation. This is done by using the native SwiftUI rendering system and SDWebImage's powerful [Animated Player](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-player-530). But it's still recommend to use `AnimatedImage` for advanced controls like progressive animation rendering, runloop mode, playback rate, etc.
113+
Note: From v0.9.0, `WebImage` supports animated image as well! You can use `.animated()` to start animation. This is done by using the native SwiftUI rendering system and SDWebImage's powerful [Animated Player](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-player-530). The `WebImage` animated image provide common use case, so it's still recommend to use `AnimatedImage` for advanced controls like progressive animation rendering.
114+
115+
```swift
116+
var body: some View {
117+
WebImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"), isAnimating: $isAnimating)) // Animation Control in 1.0.0 (for 0.x version, use `.animated()` modifier)
118+
.customLoopCount(1) // Custom loop count
119+
.playbackRate(2.0) // Playback speed rate
120+
// In 1.0.0, `WebImage` supports advanced control just like `AnimatedImage`, but without the progressive animation support
121+
}
122+
```
115123

116124
### Using `AnimatedImage` to play animation
117125

0 commit comments

Comments
 (0)