Skip to content

Commit 2936510

Browse files
committed
Update the readme about the placeholder convenient API
1 parent c9c35d0 commit 2936510

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ var body: some View {
9090
// Success
9191
}
9292
.resizable() // Resizable like SwiftUI.Image
93+
.placeholder(Image(systemName: "photo")) // Placeholder Image
94+
// Supports ViewBuilder as well
9395
.placeholder {
94-
Image(systemName: "photo") // Placeholder
96+
Rectangle().foregroundColor(.gray)
9597
}
9698
.indicator(.activity) // Activity Indicator
9799
.animation(.easeInOut(duration: 0.5)) // Animation Duration
@@ -121,7 +123,7 @@ var body: some View {
121123
// Error
122124
}
123125
.resizable() // Actually this is not needed unlike SwiftUI.Image
124-
.placeholder(UIImage(systemName: "photo")) // Placeholder
126+
.placeholder(UIImage(systemName: "photo")) // Placeholder Image
125127
.indicator(SDWebImageActivityIndicator.medium) // Activity Indicator
126128
.transition(.fade) // Fade Transition
127129
.scaledToFit() // Attention to call it on AnimatedImage, but not `some View` after View Modifier
@@ -155,7 +157,7 @@ If you don't need animated image, prefer to use `WebImage` firstly. Which behave
155157

156158
If you need animated image, `AnimatedImage` is the one to choose. Remember it supports static image as well, you don't need to check the format, just use as it.
157159

158-
But, because `AnimatedImage` use `UIViewRepresentable` and driven by UIKit, currently there may be some small incompatible issues between UIKit and SwiftUI layout and animation system. We try our best to match SwiftUI behavior, and provide the same API as `WebImage`, which make it easy to switch between these two types.
160+
But, because `AnimatedImage` use `UIViewRepresentable` and driven by UIKit, currently there may be some small incompatible issues between UIKit and SwiftUI layout and animation system, or bugs related to SwiftUI itself. We try our best to match SwiftUI behavior, and provide the same API as `WebImage`, which make it easy to switch between these two types if needed.
159161

160162
For more information, it's really recommended to check our demo below, to learn detailed API usage.
161163

0 commit comments

Comments
 (0)