Kingfisher Documentation

Enumeration KF

public enum KF  

A helper type to create image setting tasks in a builder pattern. Use methods in this type to create a KF.Builder instance and configure image tasks there.

Nested Types

KF.Builder

A builder class to configure an image retrieving task and set it to a holder view or component.

KF.RedirectPayload

Represents the detail information when a task redirect happens. It is wrapping necessary information for a ImageDownloadRedirectHandler. See that protocol for more information.

Methods

source(_:​)

public static func source(_ source: Source?) -> KF.Builder  

Creates a builder for a given Source.

Parameters

source Source?

The Source object defines data information from network or a data provider.

Returns

A KF.Builder for future configuration. After configuring the builder, call set(to:) to start the image loading.

resource(_:​)

public static func resource(_ resource: Resource?) -> KF.Builder  

Creates a builder for a given Resource.

Parameters

resource Resource?

The Resource object defines data information like key or URL.

Returns

A KF.Builder for future configuration. After configuring the builder, call set(to:) to start the image loading.

url(_:​cache​Key:​)

public static func url(_ url: URL?, cacheKey: String? = nil) -> KF.Builder  

Creates a builder for a given URL and an optional cache key.

Parameters

url URL?

The URL where the image should be downloaded.

cache​Key String?

The key used to store the downloaded image in cache. If nil, the absoluteString of url is used as the cache key.

Returns

A KF.Builder for future configuration. After configuring the builder, call set(to:) to start the image loading.

data​Provider(_:​)

public static func dataProvider(_ provider: ImageDataProvider?) -> KF.Builder  

Creates a builder for a given ImageDataProvider.

Parameters

provider Image​Data​Provider?

The ImageDataProvider object contains information about the data.

Returns

A KF.Builder for future configuration. After configuring the builder, call set(to:) to start the image loading.

data(_:​cache​Key:​)

public static func data(_ data: Data?, cacheKey: String) -> KF.Builder  

Creates a builder for some given raw data and a cache key.

Parameters

data Data?

The data object from which the image should be created.

cache​Key String

The key used to store the downloaded image in cache.

Returns

A KF.Builder for future configuration. After configuring the builder, call set(to:) to start the image loading.