File tree 2 files changed +13
-1
lines changed
Example/SDWebImageSwiftUIDemo
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ struct ContentView: View {
86
86
#if os(macOS) || os(iOS) || os(tvOS)
87
87
AnimatedImage ( url: URL ( string: url) )
88
88
. indicator ( SDWebImageActivityIndicator . medium)
89
+ /**
90
+ .placeholder(UIImage(systemName: "photo"))
91
+ */
89
92
. transition ( . fade)
90
93
. resizable ( )
91
94
. scaledToFit ( )
@@ -100,6 +103,11 @@ struct ContentView: View {
100
103
#if os(macOS) || os(iOS) || os(tvOS)
101
104
WebImage ( url: URL ( string: url) )
102
105
. resizable ( )
106
+ /**
107
+ .placeholder {
108
+ Image(systemName: "photo")
109
+ }
110
+ */
103
111
. indicator ( . activity)
104
112
. animation ( . easeInOut( duration: 0.5 ) )
105
113
. transition ( . fade)
Original file line number Diff line number Diff line change @@ -90,8 +90,11 @@ var body: some View {
90
90
// Success
91
91
}
92
92
.resizable () // Resizable like SwiftUI.Image
93
+ .placeholder {
94
+ Image (systemName : " photo" ) // Placeholder
95
+ }
93
96
.indicator (.activity ) // Activity Indicator
94
- .animation (.easeInOut (duration : 0.5 ))
97
+ .animation (.easeInOut (duration : 0.5 )) // Animation Duration
95
98
.transition (.fade ) // Fade Transition
96
99
.scaledToFit ()
97
100
.frame (width : 300 , height : 300 , alignment : .center )
@@ -118,6 +121,7 @@ var body: some View {
118
121
// Error
119
122
}
120
123
.resizable () // Actually this is not needed unlike SwiftUI.Image
124
+ .placeholder (UIImage (systemName : " photo" )) // Placeholder
121
125
.indicator (SDWebImageActivityIndicator.medium ) // Activity Indicator
122
126
.transition (.fade ) // Fade Transition
123
127
.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