Image
@available(iOS 13.0, *)
public struct Image : View
Image is a SwiftUI component for downloading images.
-
:no-doc
Declaration
Swift
@ObservedObject public var imageLoader: ImageLoader { get set }
-
Main body
Declaration
Swift
public var body: some View { get }
-
Download a remote image with the specified url.
Declaration
Swift
public init(withURL url: String, configuration: Configuration? = nil, defaultImage: ImageType? = nil, resize: 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)
resize
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(withRequest request: Request, defaultImage: ImageType? = nil, resize: 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)
resize
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)