ImageExtract
public class ImageExtract
The class that allows you to get the size of a remote image without downloading.
-
A function to get the size of an image with preferred width and max height.
Declaration
Swift
func extract(_ request: ImageRequestConvertible, preferredWidth: CGFloat, maxHeight: CGFloat = .greatestFiniteMagnitude) -> (size: CGSize, isFinished: Bool)Parameters
requestAn image url to request. String, URL, and URLRequest are conform to ImageRequestConvertible protocol.
preferredWidthA preferred width to resize.
maxHeightA maximum height to be restricted at resizing.
Return Value
A tuple value including image size and task result. If the session is cancelled or fails to extract the size of an image, the value of isFinished will be false.
-
A function to get the size of an image with preferred width and max height.
Declaration
Swift
func extract(_ request: ImageRequestConvertible, preferredWidth: CGFloat, maxHeight: CGFloat = .greatestFiniteMagnitude, completion: @escaping (String?, CGSize, Bool) -> Void)Parameters
requestAn image url to request. String, URL, and URLRequest are conform to ImageRequestConvertible protocol.
preferredWidthA preferred width to resize.
maxHeightA maximum height to be restricted at resizing.
completionA handler that called when a request is completed. If the session is cancelled or fails to extract the size of an image, the value of isFinished will be false.
-
A Boolean value indicating whether download queues are running.
Declaration
Swift
var isQueueRunning: Bool { get } -
A Integer value indicating the number of running queues.
Declaration
Swift
var queueCount: Int { get } -
A function to cancel all running queues.
Declaration
Swift
@discardableResult func cancelAllQueues() -> BoolReturn Value
A Boolean value indicating whether download queues are running.
-
A function to cancel a queue that contains a specific url.
Declaration
Swift
@discardableResult func cancelQueue(request: ImageRequestConvertible) -> BoolParameters
requestAn image url to request. String, URL, and URLRequest are conform to ImageRequestConvertible protocol.
Return Value
A Boolean value indicating whether download queues are running.
View on GitHub
ImageExtract Class Reference