|
|
@@ -106,8 +106,18 @@ public struct KFImage: View {
|
|
|
.id(context.binder)
|
|
|
}
|
|
|
|
|
|
- public func loadImmediately() -> KFImage {
|
|
|
- context.binder.start()
|
|
|
+ /// Starts the loading process of `self` immediately.
|
|
|
+ ///
|
|
|
+ /// By default, a `KFImage` will not load its source until its `onAppear` is called. This is a lazily loading
|
|
|
+ /// behavior and provides better performance. However, when you refresh the view, the lazy loading also causes a
|
|
|
+ /// flickering since the loading does not happen immediately. Call this method if you want to start the load at once
|
|
|
+ /// could help avoiding the flickering, with some performance trade-off.
|
|
|
+ ///
|
|
|
+ /// - Returns: The `Self` value with changes applied.
|
|
|
+ public func loadImmediately(_ start: Bool = true) -> KFImage {
|
|
|
+ if start {
|
|
|
+ context.binder.start()
|
|
|
+ }
|
|
|
return self
|
|
|
}
|
|
|
}
|