Skip to content

Commit 03b6e5d

Browse files
committed
Update the readme about the behavior changes on resizable
1 parent 8979158 commit 03b6e5d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ var body: some View {
121121
.onSuccess { image, cacheType in
122122
// Success
123123
}
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
125125
.placeholder(Image(systemName: "photo")) // Placeholder Image
126126
// Supports ViewBuilder as well
127127
.placeholder {
@@ -141,7 +141,8 @@ Note: From v0.9.0, `WebImage` supports animated image as well! You can use `.ani
141141

142142
```swift
143143
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`)
145146
.customLoopCount(1) // Custom loop count
146147
.playbackRate(2.0) // Playback speed rate
147148
// 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 {
166167
.onFailure { error in
167168
// Error
168169
}
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
170171
.placeholder(UIImage(systemName: "photo")) // Placeholder Image
171172
.indicator(SDWebImageActivityIndicator.medium) // Activity Indicator
172173
.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)
174175

175176
// Data
176177
AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp")))

0 commit comments

Comments
 (0)