@@ -121,7 +121,7 @@ var body: some View {
121
121
.onSuccess { image, cacheType in
122
122
// Success
123
123
}
124
- .resizable () // Resizable like SwiftUI.Image
124
+ .resizable () // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
125
125
.placeholder (Image (systemName : " photo" )) // Placeholder Image
126
126
// Supports ViewBuilder as well
127
127
.placeholder {
@@ -141,7 +141,8 @@ Note: From v0.9.0, `WebImage` supports animated image as well! You can use `.ani
141
141
142
142
``` swift
143
143
var body: some View {
144
- 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)
144
+ WebImage (url : URL (string : " https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif" ), isAnimating : $isAnimating)) // Animation Control in 1.0.0, supports dynamic changes
145
+ // The initial value of binding should be true (or you can use `.animatedImageClass` context option and pass `SDAnimatedImage`)
145
146
.customLoopCount (1 ) // Custom loop count
146
147
.playbackRate (2.0 ) // Playback speed rate
147
148
// In 1.0.0, `WebImage` supports advanced control just like `AnimatedImage`, but without the progressive animation support
@@ -166,11 +167,11 @@ var body: some View {
166
167
.onFailure { error in
167
168
// Error
168
169
}
169
- .resizable () // Actually this is not needed unlike SwiftUI.Image
170
+ .resizable () // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
170
171
.placeholder (UIImage (systemName : " photo" )) // Placeholder Image
171
172
.indicator (SDWebImageActivityIndicator.medium ) // Activity Indicator
172
173
.transition (.fade ) // Fade Transition
173
- .scaledToFit () // Attention to call it on AnimatedImage, but not `some View` after View Modifier
174
+ .scaledToFit () // Attention to call it on AnimatedImage, but not `some View` after View Modifier (Swift Protocol Extension method is static dispatched)
174
175
175
176
// Data
176
177
AnimatedImage (data : try ! Data (contentsOf : URL (fileURLWithPath : " /tmp/foo.webp" )))
0 commit comments