Kaynağa Gözat

Merge pull request #2008 from meiyongsheng/master

从本地文件缓存中读取出image对象,设置backgroundDecode之后支持异步解码
Wei Wang 3 yıl önce
ebeveyn
işleme
3e091ee962
1 değiştirilmiş dosya ile 3 ekleme ve 0 silme
  1. 3 0
      Sources/Cache/ImageCache.swift

+ 3 - 0
Sources/Cache/ImageCache.swift

@@ -608,6 +608,9 @@ open class ImageCache {
                 if let data = try self.diskStorage.value(forKey: computedKey, extendingExpiration: options.diskCacheAccessExtendingExpiration) {
                     image = options.cacheSerializer.image(with: data, options: options)
                 }
+                if options.backgroundDecode {
+                    image = image?.kf.decoded(scale: options.scaleFactor)
+                }
                 callbackQueue.execute { completionHandler(.success(image)) }
             } catch let error as KingfisherError {
                 callbackQueue.execute { completionHandler(.failure(error)) }