CacheSerializer
public protocol CacheSerializer
An CacheSerializer
would be used to convert some data to an image object for
retrieving from disk cache and vice versa for storing to disk cache.
-
Get the serialized data from a provided image and optional original data for caching to disk.
Declaration
Swift
func data(with image: Image, original: Data?) -> Data?
Parameters
image
The image needed to be serialized.
original
The original data which is just downloaded. If the image is retrieved from cache instead of downloaded, it will be
nil
.Return Value
A data which will be stored to cache, or
nil
when no valid data could be serialized. -
Get an image deserialized from provided data.
Declaration
Swift
func image(with data: Data, options: KingfisherOptionsInfo?) -> Image?
Parameters
data
The data from which an image should be deserialized.
options
Options for deserialization.
Return Value
An image deserialized or
nil
when no valid image could be deserialized.