Explorar o código

Add some comments

onevcat %!s(int64=3) %!d(string=hai) anos
pai
achega
fb62bea2c9
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      Sources/Cache/CacheSerializer.swift

+ 7 - 0
Sources/Cache/CacheSerializer.swift

@@ -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 }
 }
 
@@ -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.