KingfisherManager

public class KingfisherManager

Main manager class of Kingfisher. It connects Kingfisher downloader and cache. You can use this class to retrieve an image via a specified URL from web or cache.

  • Shared manager used by the extensions across Kingfisher.

    Declaration

    Swift

    public static let shared = KingfisherManager()
  • Cache used by this manager

    Declaration

    Swift

    public var cache: ImageCache
  • Downloader used by this manager

    Declaration

    Swift

    public var downloader: ImageDownloader
  • Default options used by the manager. This option will be used in Kingfisher manager related methods, including all image view and button extension methods. You can also passing the options per image by sending an options parameter to Kingfisher’s APIs, the per image option will overwrite the default ones if exist.

    Note

    This option will not be applied to independent using of ImageDownloader or ImageCache.

    Declaration

    Swift

    public var defaultOptions = KingfisherEmptyOptionsInfo
  • Get an image with resource. If KingfisherOptions.None is used as options, Kingfisher will seek the image in memory and disk first. If not found, it will download the image at resource.downloadURL and cache it with resource.cacheKey. These default behaviors could be adjusted by passing different options. See KingfisherOptions for more.

    Declaration

    Swift

    public func retrieveImage(with resource: Resource,
            options: KingfisherOptionsInfo?,
            progressBlock: DownloadProgressBlock?,
            completionHandler: CompletionHandler?) -> RetrieveImageTask

    Parameters

    resource

    Resource object contains information such as cacheKey and downloadURL.

    options

    A dictionary could control some behaviors. See KingfisherOptionsInfo for more.

    progressBlock

    Called every time downloaded data changed. This could be used as a progress UI.

    completionHandler

    Called when the whole retrieving process finished.

    Return Value

    A RetrieveImageTask task object. You can use this object to cancel the task.