ImageDownloader

open class ImageDownloader

Represents a downloading manager for requesting the image with a URL from server.

  • The default downloader.

    Declaration

    Swift

    public static let `default`: ImageDownloader
  • Creates a downloader with name.

    Declaration

    Swift

    public init(name: String)

    Parameters

    name

    The name for the downloader. It should not be empty.

  • Cancel all downloading tasks for this ImageDownloader. It will trigger the completion handlers for all not-yet-finished downloading tasks.

    If you need to only cancel a certain task, call cancel() on the DownloadTask returned by the downloading methods. If you need to cancel all DownloadTasks of a certain url, use ImageDownloader.cancel(url:).

    Declaration

    Swift

    public func cancelAll()
  • Cancel all downloading tasks for a given URL. It will trigger the completion handlers for all not-yet-finished downloading tasks for the URL.

    Declaration

    Swift

    public func cancel(url: URL)

    Parameters

    url

    The URL which you want to cancel downloading.