Kingfisher Documentation

Classes

Disk​Storage.​Backend

Represents a storage back-end for the DiskStorage. The value is serialized to data and stored as file in the file system under a specified location.

Image​Cache

Represents a hybrid caching system which is composed by a MemoryStorage.Backend and a DiskStorage.Backend. ImageCache is a high level abstract for storing an image as well as its data to disk memory and disk, and retrieving them back.

Memory​Storage.​Backend

Represents a storage which stores a certain type of value in memory. It provides fast access, but limited storing size. The stored value type needs to conform to CacheCostCalculable, and its cacheCost will be used to determine the cost of size for the cache item.

KF.​Builder

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

Kingfisher​Manager

Main manager class of Kingfisher. It connects Kingfisher downloader and cache, to provide a set of convenience methods to use Kingfisher for tasks. You can use this class to retrieve an image via a specified URL from web or cache.

GIFAnimated​Image

Represents the decoding for a GIF image. This class extracts frames from an imageSource, then hold the images for later use.

Image​Downloader

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

Image​Prefetcher

ImagePrefetcher represents a downloading manager for requesting many images via URLs, then caching them. This is useful when you know a list of image resources and want to download them before showing. It also works with some Cocoa prefetching mechanism like table view or collection view prefetchDataSource, to start image downloading and caching before they display on screen.

Retry​Context

Represents a retry context which could be used to determine the current retry status.

Session​Data​Task

Represents a session data task in ImageDownloader. It consists of an underlying URLSessionDataTask and an array of TaskCallback. Multiple TaskCallbacks could be added for a single downloading data task.

Session​Delegate
KFImage.​Context
Delegate

A class that keeps a weakly reference for self when implementing onXXX behaviors. Instead of remembering to keep self as weak in a stored closure:

Animated​Image​View

Represents a subclass of UIImageView for displaying animated image. Different from showing animated image in a normal UIImageView (which load all frames at one time), AnimatedImageView only tries to load several frames (defined by framePreloadCount) to reduce memory usage. It provides a tradeoff between memory usage and CPU time. If you have a memory issue when using a normal image view to load GIF data, you could give this class a try.

Animated​Image​View.​Animator

An animator which used to drive the data behind AnimatedImageView.

Structures

Default​Cache​Serializer

Represents a basic and default CacheSerializer used in Kingfisher disk cache system. It could serialize and deserialize images in PNG, JPEG and GIF format. For image other than these formats, a normalized pngRepresentation will be used.

Disk​Storage.​Config

Represents the config used in a DiskStorage.

Format​Indicated​Cache​Serializer

FormatIndicatedCacheSerializer lets you indicate an image format for serialized caches.

Cache​Store​Result

Represents the caching operation result.

Memory​Storage.​Config

Represents the config used in a MemoryStorage.

AVAsset​Image​Data​Provider

A data provider to provide thumbnail data from a given AVKit asset.

Local​File​Image​Data​Provider

Represents an image data provider for loading from a local file URL on disk. Uses this type for adding a disk image to Kingfisher. Compared to loading it directly, you can get benefit of using Kingfisher's extension methods, as well as applying ImageProcessors and storing the image to ImageCache of Kingfisher.

Base64Image​Data​Provider

Represents an image data provider for loading image from a given Base64 encoded string.

Raw​Image​Data​Provider

Represents an image data provider for a raw data object.

Image​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.

KF.​Redirect​Payload

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

Kingfisher​Wrapper

Wrapper for Kingfisher compatible types. This type provides an extension point for convenience methods in Kingfisher.

Retrieve​Image​Result

Represents the result of a Kingfisher retrieving image task.

Propagation​Error

A struct that stores some related information of an KingfisherError. It provides some context information for a pure error so you can identify the error easier.

Kingfisher​Parsed​Options​Info

The parsed options info used across Kingfisher methods. Each property in this type corresponds a case member in KingfisherOptionsInfoItem. When a KingfisherOptionsInfo sent to Kingfisher related methods, it will be parsed and converted to a KingfisherParsedOptionsInfo first, and pass through the internal methods.

Filter

A wrapper struct for a Transformer of CIImage filters. A Filter value could be used to create a CIImage processor.

Image​Creating​Options

Represents a set of image creating options used in Kingfisher.

Default​Image​Processor

The default processor. It converts the input data to a valid image. Images of .PNG, .JPEG and .GIF format are supported. If an image item is given as .image case, DefaultImageProcessor will do nothing on it and return the associated image.

Rect​Corner

Represents the rect corner setting when processing a round corner image.

Blend​Image​Processor

Processor for adding an blend mode to images. Only CG-based images are supported.

Compositing​Image​Processor

Processor for adding an compositing operation to images. Only CG-based images are supported in macOS.

Round​Corner​Image​Processor

Processor for making round corner images. Only CG-based images are supported in macOS, if a non-CG image passed in, the processor will do nothing.

Border
Border​Image​Processor
Resizing​Image​Processor

Processor for resizing images. If you need to resize a data represented image to a smaller size, use DownsamplingImageProcessor instead, which is more efficient and uses less memory.

Blur​Image​Processor

Processor for adding blur effect to images. Accelerate.framework is used underhood for a better performance. A simulated Gaussian blur with specified blur radius will be applied.

Overlay​Image​Processor

Processor for adding an overlay to images. Only CG-based images are supported in macOS.

Tint​Image​Processor

Processor for tint images with color. Only CG-based images are supported.

Color​Controls​Processor

Processor for applying some color control to images. Only CG-based images are supported. watchOS is not supported.

Black​White​Processor

Processor for applying black and white effect to images. Only CG-based images are supported. watchOS is not supported.

Cropping​Image​Processor

Processor for cropping an image. Only CG-based images are supported. watchOS is not supported.

Downsampling​Image​Processor

Processor for downsampling an image. Compared to ResizingImageProcessor, this processor does not render the images to resize. Instead, it downsamples the input data directly to an image. It is a more efficient than ResizingImageProcessor. Prefer to use DownsamplingImageProcessor as possible as you can than the ResizingImageProcessor.

Image​Progressive
Image​Loading​Result

Represents a success result of an image downloading progress.

Download​Task

Represents a task of an image downloading process.

Any​Image​Modifier

A wrapper for creating an ImageModifier easier. This type conforms to ImageModifier and wraps an image modify block. If the block throws an error, the original image will be used.

Rendering​Mode​Image​Modifier

Modifier for setting the rendering mode of images.

Flips​For​Right​ToLeft​Layout​Direction​Image​Modifier

Modifier for setting the flipsForRightToLeftLayoutDirection property of images.

Alignment​Rect​Insets​Image​Modifier

Modifier for setting the alignmentRectInsets property of images.

Any​Redirect​Handler

A wrapper for creating an ImageDownloadRedirectHandler easier. This type conforms to ImageDownloadRedirectHandler and wraps a redirect request modify block.

Any​Modifier

A wrapper for creating an ImageDownloadRequestModifier easier. This type conforms to ImageDownloadRequestModifier and wraps an image modify block.

Delay​Retry​Strategy

A retry strategy that guides Kingfisher to retry when a .responseError happens, with a specified max retry count and a certain interval mechanism.

KFAnimated​Image
KFAnimated​Image​View​Representer

A wrapped UIViewRepresentable of AnimatedImageView

KFImage

Enumerations

Disk​Storage

Represents a set of conception related to storage which stores a certain type of value in disk. This is a namespace for the disk storage types. A Backend with a certain Config will be used to describe the storage. See these composed types for more information.

Cache​Type

Cache type of a cached image.

Image​Cache​Result

Represents the getting image operation from the cache.

Memory​Storage

Represents a set of conception related to storage which stores a certain type of value in memory. This is a namespace for the memory storage types. A Backend with a certain Config will be used to describe the storage. See these composed types for more information.

Storage​Expiration

Represents the expiration strategy used in storage.

Expiration​Extending

Represents the expiration extending strategy used in storage to after access.

AVAsset​Image​Data​Provider.​AVAsset​Image​Data​Provider​Error

The possible error might be caused by the AVAssetImageDataProvider.

Source

Represents an image setting source for Kingfisher methods.

Source.​Identifier

Represents the source task identifier when setting an image to a view with extension methods.

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.

Kingfisher​Error

Represents all the errors which can happen in Kingfisher framework. Kingfisher related methods always throw a KingfisherError or invoke the callback with KingfisherError as its error type. To handle errors from Kingfisher, you switch over the error to get a reason catalog, then switch over the reason to know error detail.

Kingfisher​Error.​Request​Error​Reason

Represents the error reason during networking request phase.

Kingfisher​Error.​Response​Error​Reason

Represents the error reason during networking response phase.

Kingfisher​Error.​Cache​Error​Reason

Represents the error reason during Kingfisher caching system.

Kingfisher​Error.​Processor​Error​Reason

Represents the error reason during image processing phase.

Kingfisher​Error.​Image​Setting​Error​Reason

Represents the error reason during image setting in a view related class.

Kingfisher​Options​Info​Item

Represents the available option items could be used in KingfisherOptionsInfo.

Image​Format

Represents image format.

Image​Format.​JPEGMarker

https://en.wikipedia.org/wiki/JPEG

Image​Process​Item

Represents an item which could be processed by an ImageProcessor.

Radius

Represents a radius specified in a RoundCornerImageProcessor.

Content​Mode

Represents how a size adjusts itself to fit a target size.

Image​Transition

Transition effect which will be used when an image downloaded and set by UIImageView extension API in Kingfisher. You can assign an enum value with transition duration as an item in KingfisherOptionsInfo to enable the animation transition.

Image​Transition
Retry​Decision

Represents decision of behavior on the current retry.

Delay​Retry​Strategy.​Interval

Represents the interval mechanism which used in a DelayRetryStrategy.

Callback​Queue

Represents callback queue behaviors when an calling of closure be dispatched.

Animated​Image​View.​Repeat​Count

Enumeration that specifies repeat count of GIF

Indicator​Type

Represents the activity indicator type which should be added to an image view when an image is being downloaded.

Indicator​Size​Strategy

Protocols

Cache​Serializer

An CacheSerializer is used to convert some data to an image object after retrieving it from disk storage, and vice versa, to convert an image to data object for storing to the disk storage.

Cache​Cost​Calculable

Represents types which cost in memory can be calculated.

Data​Transformable

Represents types which can be converted to and from data.

Image​Data​Provider

Represents a data provider to provide image data to Kingfisher when setting with Source.provider source. Compared to Source.network member, it gives a chance to load some image data in your own way, as long as you can provide the data representation for the image.

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 Source.network as its image setting source.

KFOption​Setter
Kingfisher​Compatible

Represents an object type that is compatible with Kingfisher. You can use kf property to get a value in the namespace of Kingfisher.

Kingfisher​Compatible​Value

Represents a value type that is compatible with Kingfisher. You can use kf property to get a value in the namespace of Kingfisher.

CIImage​Processor

Represents a processor based on a CIImage Filter. It requires a filter to create an ImageProcessor.

Image​Processor

An ImageProcessor would be used to convert some downloaded data to an image.

Placeholder

Represents a placeholder type which could be set while loading as well as loading finished without getting an image.

Authentication​Challenge​Responsible

Protocol indicates that an authentication challenge could be handled.

Image​Downloader​Delegate

Protocol of ImageDownloader. This protocol provides a set of methods which are related to image downloader working stages and rules.

Image​Modifier

An ImageModifier can be used to change properties on an image between cache serialization and the actual use of the image. The modify(_:) method will be called after the image retrieved from its source and before it returned to the caller. This modified image is expected to be only used for rendering purpose, any changes applied by the ImageModifier will not be serialized or cached.

Image​Download​Redirect​Handler

Represents and wraps a method for modifying request during an image download request redirection.

Async​Image​Download​Request​Modifier

Represents and wraps a method for modifying request before an image download request starts in an asynchronous way.

Image​Download​Request​Modifier

Represents and wraps a method for modifying request before an image download request starts.

Retry​Strategy

Defines a retry strategy can be applied to a .retryStrategy option.

KFImage​Protocol
KFImage​Holding​View
Optional​Protocol
Animated​Image​View​Delegate

Protocol of AnimatedImageView.

Indicator

An indicator type which can be used to show the download task is in progress.

Typealiases

KFCross​Platform​Image
KFCross​Platform​View
KFCross​Platform​Color
KFCross​Platform​Image​View
KFCross​Platform​Button
KFCross​Platform​Image
KFCross​Platform​Color
KFCross​Platform​Image​View
KFCross​Platform​View
KFCross​Platform​Button
Download​Progress​Block

The downloading progress block type. The parameter value is the receivedSize of current response. The second parameter is the total expected data length from response's "Content-Length" header. If the expected length is not available, this block will not be called.

Download​Task​Updated​Block

The downloading task updated block type. The parameter newTask is the updated new task of image setting process. It is a nil if the image loading does not require an image downloading process. If an image downloading is issued, this value will contain the actual DownloadTask for you to keep and cancel it later if you need.

Kingfisher​Options​Info

KingfisherOptionsInfo is a typealias for [KingfisherOptionsInfoItem]. You can use the enum of option item with value to control some behaviors of Kingfisher.

Transformer

Represents the type of transformer method, which will be used in to provide a Filter.

Authentication​Challenge​Responsable
Prefetcher​Progress​Block

Progress update block of prefetcher when initialized with a list of resources.

Prefetcher​Source​Progress​Block

Progress update block of prefetcher when initialized with a list of resources.

Prefetcher​Completion​Handler

Completion block of prefetcher when initialized with a list of sources.

Prefetcher​Source​Completion​Handler

Completion block of prefetcher when initialized with a list of sources.

Execution​Queue
Indicator​View
Indicator​View

Variables

Kingfisher​Disk​Cache​Cleaned​Hash​Key

Key for array of cleaned hashes in userInfo of KingfisherDidCleanDiskCacheNotification.

Operators

|>

Extensions

Data
KFCrossPlatformImage
Notification.Name
Optional
URL