Просмотр исходного кода

从本地文件缓存中读取出image对象,设置backgroundDecode之后支持异步解码

yongshemmei 3 лет назад
Родитель
Сommit
53e43704f6
1 измененных файлов с 3 добавлено и 0 удалено
  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 {
                 if let error = error as? KingfisherError {