|
|
@@ -32,6 +32,16 @@ private let sharedProcessingQueue: CallbackQueue =
|
|
|
|
|
|
public struct ImageProgressive {
|
|
|
|
|
|
+ /// The updating strategy when an intermediate progressive image is generated and about to be set to the hosting view.
|
|
|
+ ///
|
|
|
+ /// - keep: Do not change the received intermediate progressive image. Just use as it is.
|
|
|
+ /// - replace: Replace the image to a new one. If the progressive loading is initialized by a view extension in
|
|
|
+ /// Kingfisher, the replacing image will be used to update the view.
|
|
|
+ public enum UpdatingStrategy {
|
|
|
+ case keep
|
|
|
+ case replace(KFCrossPlatformImage?)
|
|
|
+ }
|
|
|
+
|
|
|
/// A default `ImageProgressive` could be used across. It blurs the progressive loading with the fastest
|
|
|
/// scan enabled and scan interval as 0.
|
|
|
public static let `default` = ImageProgressive(
|
|
|
@@ -47,7 +57,10 @@ public struct ImageProgressive {
|
|
|
/// Minimum time interval for each scan
|
|
|
let scanInterval: TimeInterval
|
|
|
|
|
|
- public let onImageUpdated = Delegate<KFCrossPlatformImage, Void>()
|
|
|
+ /// Called when an intermediate image is prepared and about to be set to the image view. The return value of this
|
|
|
+ /// delegate will be used to update the hosting view, if any. Otherwise, if there is no hosting view (a.k.a the
|
|
|
+ /// image retrieving is not happening from a view extension method), the returned `UpdatingStrategy` is ignored.
|
|
|
+ public let onImageUpdated = Delegate<KFCrossPlatformImage, UpdatingStrategy>()
|
|
|
|
|
|
public init(isBlur: Bool,
|
|
|
isFastestScan: Bool,
|