Image
@available(iOS 13.0, *)
public struct Image : View
Image is a SwiftUI component for downloading images.
-
Main body
Declaration
Swift
public var body: some View { get }
-
Download a remote image with the specified url.
Declaration
Swift
public init(url: String, configuration: Configuration? = nil, defaultImage: ImageType? = nil, resizeTo size: CGSize? = nil, preprocessImage: ImagePreprocessType? = nil, onFinish: ImageOnFinishCallbackType? = nil)
Parameters
url
The url of the image.
configuration
A Configuration object that will be used to make the request.
defaultImage
A UIImage|NSImage to show before the is downloaded (optional)
resizeTo
Resizes the image to the given CGSize
preprocessImage
A block of code that preprocesses the after the download. This block will run in the background thread
onFinish
A block of code to execute after the completion of the request. If the request fails, an error will be returned
-
Download a remote image with the specified url.
Declaration
Swift
public init(request: Request, defaultImage: ImageType? = nil, resizeTo size: CGSize? = nil, preprocessImage: ImagePreprocessType? = nil, onFinish: ImageOnFinishCallbackType? = nil)
Parameters
request
A Request instance.
configuration
A Configuration object that will be used to make the request.
defaultImage
A UIImage|NSImage to show before the is downloaded (optional)
resizeTo
Resizes the image to the given CGSize
preprocessImage
A block of code that preprocesses the after the download. This block will run in the background thread (optional)