Add the convenient method for WebImage to directly supply SwiftUI.Image for placeholder

This commit is contained in:
DreamPiggy 2019-11-09 17:05:07 +08:00
parent 5029a88273
commit c9c35d0281
1 changed files with 11 additions and 0 deletions

View File

@ -151,6 +151,17 @@ extension WebImage {
return result
}
/// Associate a placeholder image when loading image with url
/// - 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
/// - Parameter image: A Image view that describes the placeholder.
public func placeholder(_ image: Image) -> WebImage {
return placeholder {
configurations.reduce(image) { (previous, configuration) in
configuration(previous)
}
}
}
/// Control the behavior to retry the failed loading when view become appears again
/// - Parameter flag: Whether or not to retry the failed loading
public func retryOnAppear(_ flag: Bool) -> WebImage {