You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// A Binding to control the animation. You can bind external logic to control the animation status.
52
91
/// True to start animation, false to stop animation.
@@ -72,7 +111,23 @@ public struct WebImage : View {
72
111
/// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values.
73
112
/// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
74
113
/// - Parameter isAnimating: The binding for animation control. The binding value should be `true` when initialized to setup the correct animated image class. If not, you must provide the `.animatedImageClass` explicitly. When the animation started, this binding can been used to start / stop the animation.
/// Create a web image with url, placeholder, custom options and context.
95
-
/// - Parameter url: The image url
96
-
/// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values.
97
-
/// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
@@ -279,25 +326,6 @@ public struct WebImage : View {
279
326
}
280
327
}
281
328
}
282
-
283
-
/// Placeholder View Support
284
-
func setupPlaceholder()->someView{
285
-
// Don't use `Group` because it will trigger `.onAppear` and `.onDisappear` when condition view removed, treat placeholder as an entire component
286
-
letresult:AnyView
287
-
iflet placeholder = placeholder {
288
-
// If use `.delayPlaceholder`, the placeholder is applied after loading failed, hide during loading :)
289
-
if imageModel.options.contains(.delayPlaceholder) && imageManager.error ==nil{
290
-
result =AnyView(configure(image:.empty))
291
-
}else{
292
-
result = placeholder
293
-
}
294
-
}else{
295
-
result =AnyView(configure(image:.empty))
296
-
}
297
-
// Custom ID to avoid SwiftUI engine cache the status, and does not call `onAppear` when placeholder not changed (See `ContentView.swift/ContentView2` case)
298
-
// Because we load the image url in placeholder's `onAppear`, it should be called to sync with state changes :)
/// Associate a placeholder when loading image with url
378
-
/// - note: The differences between Placeholder and Indicator, is that placeholder does not supports animation, and return type is different
379
-
/// - Parameter content: A view that describes the placeholder.
380
-
publicfunc placeholder<T>(@ViewBuilder content:()->T)->WebImagewhere T :View{
381
-
varresult=self
382
-
result.placeholder =AnyView(content())
383
-
return result
384
-
}
385
-
386
-
/// Associate a placeholder image when loading image with url
387
-
/// - note: This placeholder image will apply the same size and resizable from WebImage for convenience. If you don't want this, use the ViewBuilder one above instead
388
-
/// - Parameter image: A Image view that describes the placeholder.
0 commit comments