Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Oct 8, 2022
1 parent c428b7b commit fb62bea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/Cache/CacheSerializer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public protocol CacheSerializer {
/// could be deserialized.
func image(with data: Data, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage?

/// Whether this serializer prefers to cache the original data in its implementation.
/// If `true`, after creating the image from the disk data, Kingfisher will continue to apply the processor to get
/// the final image.
///
/// By default, it is `false` and the actual processed image is assumed to be serialized to the disk.
var originalDataUsed: Bool { get }
}

Expand All @@ -76,6 +81,8 @@ public struct DefaultCacheSerializer: CacheSerializer {
/// In that case, the serialization will fall back to creating data from image.
public var preferCacheOriginalData: Bool = false

/// Returnes the `preferCacheOriginalData` value. When the original data is used, Kingfisher needs to re-apply the
/// processors to get the desired final image.
public var originalDataUsed: Bool { preferCacheOriginalData }

/// Creates a cache serializer that serialize and deserialize images in PNG, JPEG and GIF format.
Expand Down

0 comments on commit fb62bea

Please sign in to comment.