Remove the wrong design onSuccess API. Using the full params one instead

This commit is contained in:
DreamPiggy 2021-02-23 16:12:35 +08:00
parent af644e483f
commit 59a9614605
3 changed files with 0 additions and 63 deletions

View File

@ -736,28 +736,6 @@ extension AnimatedImage {
return self
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image. If `action` is `nil`, the call has no effect.
/// - Returns: A view that triggers `action` when this image load successes.
public func onSuccess(perform action: @escaping (PlatformImage) -> Void) -> AnimatedImage {
self.imageHandler.successBlock = { image, _, _ in
action(image)
}
return self
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image, the second arg is the cache type loaded from. If `action` is `nil`, the call has no effect.
/// - Returns: A view that triggers `action` when this image load successes.
public func onSuccess(perform action: @escaping (PlatformImage, SDImageCacheType) -> Void) -> AnimatedImage {
self.imageHandler.successBlock = { image, _, cacheType in
action(image, cacheType)
}
return self
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image, the second arg is the loaded image data, the third arg is the cache type loaded from. If `action` is `nil`, the call has no effect.

View File

@ -124,24 +124,6 @@ extension ImageManager {
self.failureBlock = action
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image. If `action` is `nil`, the call has no effect.
public func setOnSuccess(perform action: @escaping (PlatformImage) -> Void) {
self.successBlock = { image, _, _ in
action(image)
}
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image, the second arg is the cache type loaded from. If `action` is `nil`, the call has no effect.
public func setOnSuccess(perform action: @escaping (PlatformImage, SDImageCacheType) -> Void) {
self.successBlock = { image, _, cacheType in
action(image, cacheType)
}
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image, the second arg is the loaded image data, the third arg is the cache type loaded from. If `action` is `nil`, the call has no effect.

View File

@ -238,29 +238,6 @@ extension WebImage {
return self
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image. If `action` is `nil`, the call has no effect.
/// - Returns: A view that triggers `action` when this image load successes.
public func onSuccess(perform action: @escaping (PlatformImage) -> Void) -> WebImage {
let action = action
self.imageManager.successBlock = { image, _, _ in
action(image)
}
return self
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image, the second arg is the cache type loaded from. If `action` is `nil`, the call has no effect.
/// - Returns: A view that triggers `action` when this image load successes.
public func onSuccess(perform action: @escaping (PlatformImage, SDImageCacheType) -> Void) -> WebImage {
self.imageManager.successBlock = { image, _, cacheType in
action(image, cacheType)
}
return self
}
/// Provide the action when image load successes.
/// - Parameters:
/// - action: The action to perform. The first arg is the loaded image, the second arg is the loaded image data, the third arg is the cache type loaded from. If `action` is `nil`, the call has no effect.