Kingfisher Documentation

Protocol Resource

public protocol Resource  

Represents an image resource at a certain url and a given cache key. Kingfisher will use a Resource to download a resource from network and cache it with the cache key when using as its image setting source.

%33 Resource Resource ImageResource ImageResource ImageResource->Resource

Types Conforming to Resource


ImageResource is a simple combination of downloadURL and cacheKey. When passed to image view set methods, Kingfisher will try to download the target image from the downloadURL, and then store it with the cacheKey as the key in cache.

Default Implementations


public func convertToSource(overrideCacheKey: String? = nil) -> Source  

Converts self to a valid Source based on its downloadURL scheme. A .provider with LocalFileImageDataProvider associated will be returned if the URL points to a local file. Otherwise, .network is returned.



var cacheKey: String  

The key used in cache.


var downloadURL: URL  

The target image URL.