Merge pull request #169 from SDWebImage/api_remove

Remove the wrong design onSuccess API. Using the full params one instead
This commit is contained in:
DreamPiggy 2021-02-23 16:19:03 +08:00 committed by GitHub
commit b26da2eed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 63 deletions

View File

@ -736,28 +736,6 @@ extension AnimatedImage {
return self 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. /// Provide the action when image load successes.
/// - Parameters: /// - 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. /// - 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 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. /// Provide the action when image load successes.
/// - Parameters: /// - 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. /// - 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 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. /// Provide the action when image load successes.
/// - Parameters: /// - 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. /// - 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.