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
imageThe image needed to be serialized.
originalThe 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
nilwhen no valid data could be serialized. -
Get an image deserialized from provided data.
Declaration
Swift
func image(with data: Data, options: KingfisherOptionsInfo?) -> Image?Parameters
dataThe data from which an image should be deserialized.
optionsOptions for deserialization.
Return Value
An image deserialized or
nilwhen no valid image could be deserialized.
View on GitHub
Install in Dash
CacheSerializer Protocol Reference