File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Example/SDWebImageSwiftUIDemo Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ struct ContentView: View {
8686 #if os(macOS) || os(iOS) || os(tvOS)
8787 AnimatedImage ( url: URL ( string: url) )
8888 . indicator ( SDWebImageActivityIndicator . medium)
89+ /**
90+ .placeholder(UIImage(systemName: "photo"))
91+ */
8992 . transition ( . fade)
9093 . resizable ( )
9194 . scaledToFit ( )
@@ -100,6 +103,11 @@ struct ContentView: View {
100103 #if os(macOS) || os(iOS) || os(tvOS)
101104 WebImage ( url: URL ( string: url) )
102105 . resizable ( )
106+ /**
107+ .placeholder {
108+ Image(systemName: "photo")
109+ }
110+ */
103111 . indicator ( . activity)
104112 . animation ( . easeInOut( duration: 0.5 ) )
105113 . transition ( . fade)
Original file line number Diff line number Diff line change @@ -90,8 +90,11 @@ var body: some View {
9090 // Success
9191 }
9292 .resizable () // Resizable like SwiftUI.Image
93+ .placeholder {
94+ Image (systemName : " photo" ) // Placeholder
95+ }
9396 .indicator (.activity ) // Activity Indicator
94- .animation (.easeInOut (duration : 0.5 ))
97+ .animation (.easeInOut (duration : 0.5 )) // Animation Duration
9598 .transition (.fade ) // Fade Transition
9699 .scaledToFit ()
97100 .frame (width : 300 , height : 300 , alignment : .center )
@@ -118,6 +121,7 @@ var body: some View {
118121 // Error
119122 }
120123 .resizable () // Actually this is not needed unlike SwiftUI.Image
124+ .placeholder (UIImage (systemName : " photo" )) // Placeholder
121125 .indicator (SDWebImageActivityIndicator.medium ) // Activity Indicator
122126 .transition (.fade ) // Fade Transition
123127 .scaledToFit () // Attention to call it on AnimatedImage, but not `some View` after View Modifier
You can’t perform that action at this time.
0 commit comments