onevcat il y a 9 ans
Parent
commit
0af9630b0d
2 fichiers modifiés avec 14 ajouts et 1 suppressions
  1. 1 1
      Sources/ImageCache.swift
  2. 13 0
      Sources/ImageDownloader.swift

+ 1 - 1
Sources/ImageCache.swift

@@ -609,7 +609,7 @@ extension ImageCache {
     
     - parameter completionHandler: Called with the calculated size when finishes.
     */
-    public func calculateDiskCacheSizeWithCompletionHandler(_ completionHandler: ((_ size: UInt) -> ())) {
+    public func calculateDiskCacheSize(completionHandler: ((_ size: UInt) -> ())) {
         ioQueue.async(execute: { () -> Void in
             let (_, diskCacheSize, _) = self.travelCachedFiles(onlyForCacheSize: true)
             DispatchQueue.main.async(execute: { () -> Void in

+ 13 - 0
Sources/ImageDownloader.swift

@@ -108,6 +108,19 @@ struct NoModifier: ImageDownloadRequestModifier {
     }
 }
 
+public struct AnyModifier: ImageDownloadRequestModifier {
+    
+    let block: (URLRequest) -> URLRequest?
+    
+    public func modified(for request: URLRequest) -> URLRequest? {
+        return block(request)
+    }
+
+    public init(modify: @escaping (URLRequest) -> URLRequest? ) {
+        block = modify
+    }
+}
+
 /// Protocol of `ImageDownloader`.
 public protocol ImageDownloaderDelegate: class {
     /**