diff --git a/Example/SDWebImageSwiftUIDemo/ContentView.swift b/Example/SDWebImageSwiftUIDemo/ContentView.swift index fe46639..cc3b339 100644 --- a/Example/SDWebImageSwiftUIDemo/ContentView.swift +++ b/Example/SDWebImageSwiftUIDemo/ContentView.swift @@ -86,6 +86,9 @@ struct ContentView: View { #if os(macOS) || os(iOS) || os(tvOS) AnimatedImage(url: URL(string:url)) .indicator(SDWebImageActivityIndicator.medium) + /** + .placeholder(UIImage(systemName: "photo")) + */ .transition(.fade) .resizable() .scaledToFit() @@ -100,6 +103,11 @@ struct ContentView: View { #if os(macOS) || os(iOS) || os(tvOS) WebImage(url: URL(string:url)) .resizable() + /** + .placeholder { + Image(systemName: "photo") + } + */ .indicator(.activity) .animation(.easeInOut(duration: 0.5)) .transition(.fade) diff --git a/README.md b/README.md index 0737ac4..06ecec4 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,11 @@ var body: some View { // Success } .resizable() // Resizable like SwiftUI.Image + .placeholder { + Image(systemName: "photo") // Placeholder + } .indicator(.activity) // Activity Indicator - .animation(.easeInOut(duration: 0.5)) + .animation(.easeInOut(duration: 0.5)) // Animation Duration .transition(.fade) // Fade Transition .scaledToFit() .frame(width: 300, height: 300, alignment: .center) @@ -118,6 +121,7 @@ var body: some View { // Error } .resizable() // Actually this is not needed unlike SwiftUI.Image + .placeholder(UIImage(systemName: "photo")) // Placeholder .indicator(SDWebImageActivityIndicator.medium) // Activity Indicator .transition(.fade) // Fade Transition .scaledToFit() // Attention to call it on AnimatedImage, but not `some View` after View Modifier