FormatIndicatedCacheSerializer
public struct FormatIndicatedCacheSerializer: CacheSerializer
FormatIndicatedCacheSerializer
let you indicate an image format for serialized caches.
It could serialize and deserialize PNG, JEPG and GIF images. For
image other than these formats, a normalized pngRepresentation
will be used.
Example:
private let profileImageSize = CGSize(width: 44, height: 44)
private let imageProcessor = RoundCornerImageProcessor(
cornerRadius: profileImageSize.width / 2, targetSize: profileImageSize)
private let optionsInfo: KingfisherOptionsInfo = [
.cacheSerializer(FormatIndicatedCacheSerializer.png),
.backgroundDecode, .processor(imageProcessor), .scaleFactor(UIScreen.main.scale)]
extension UIImageView {
func setProfileImage(with url: URL) {
// Image will always cached as PNG format to preserve alpha channel for round rect.
_ = kf.setImage(with: url, options: optionsInfo)
}
}
-
Undocumented
Declaration
Swift
public struct FormatIndicatedCacheSerializer: CacheSerializer
-
Undocumented
Declaration
Swift
public struct FormatIndicatedCacheSerializer: CacheSerializer
-
Undocumented
Declaration
Swift
public struct FormatIndicatedCacheSerializer: CacheSerializer
-
Declaration
Swift
public func data(with image: Image, original: Data?) -> Data?
-
Same implementation as
DefaultCacheSerializer
.Declaration
Swift
public func image(with data: Data, options: KingfisherOptionsInfo?) -> Image?