onevcat il y a 9 ans
Parent
commit
bff7a8759b
2 fichiers modifiés avec 6 ajouts et 8 suppressions
  1. 2 2
      Sources/ImageDownloader.swift
  2. 4 6
      Sources/KingfisherManager.swift

+ 2 - 2
Sources/ImageDownloader.swift

@@ -80,14 +80,14 @@ The error code.
 
 - BadData: The downloaded data is not an image or the data is corrupted.
 - NotModified: The remote server responsed a 304 code. No image data downloaded.
-- NotCached: The image rquested is not in cache and CacheOnly is activated
+- NotCached: The image rquested is not in cache but OnlyFromCache is activated.
 - InvalidURL: The URL is invalid.
 */
 public enum KingfisherError: Int {
     case BadData = 10000
     case NotModified = 10001
     case InvalidStatusCode = 10002
-	case NotCached = 10003
+    case NotCached = 10003
     case InvalidURL = 20000
 }
 

+ 4 - 6
Sources/KingfisherManager.swift

@@ -218,11 +218,8 @@ public class KingfisherManager {
                 if image != nil {
                     diskTaskCompletionHandler(image: image, error: nil, cacheType:cacheType, imageURL: URL)
                 } else if let options = options where options.onlyFromCache {
-                    diskTaskCompletionHandler(image: nil,
-                        error: NSError(domain: KingfisherErrorDomain, code: KingfisherError.NotCached.rawValue, userInfo: nil),
-                        cacheType:.None,
-                        imageURL: URL)
-                    return
+                    let error = NSError(domain: KingfisherErrorDomain, code: KingfisherError.NotCached.rawValue, userInfo: nil)
+                    diskTaskCompletionHandler(image: nil, error: error, cacheType:.None, imageURL: URL)
                 } else {
                     self.downloadAndCacheImageWithURL(URL,
                         forKey: key,
@@ -231,7 +228,8 @@ public class KingfisherManager {
                         completionHandler: diskTaskCompletionHandler,
                         options: options)
                 }
-            })
+            }
+        )
         retrieveImageTask.diskRetrieveTask = diskTask
     }
 }