Browse Source

Merge pull request #1525 from onevcat/fix/remove-deprecated

Remove deprecated things
Wei Wang 5 năm trước cách đây
mục cha
commit
1255e3160f

+ 0 - 4
Kingfisher.xcodeproj/project.pbxproj

@@ -99,7 +99,6 @@
 		D1A37BDE215D34E8009B39B7 /* ImageDrawing.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1A37BDD215D34E8009B39B7 /* ImageDrawing.swift */; };
 		D1A37BE3215D359F009B39B7 /* ImageFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1A37BE2215D359F009B39B7 /* ImageFormat.swift */; };
 		D1A37BE8215D365A009B39B7 /* ExtensionHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1A37BE7215D365A009B39B7 /* ExtensionHelpers.swift */; };
-		D1A37BED215D375F009B39B7 /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1A37BEC215D375F009B39B7 /* Deprecated.swift */; };
 		D1A37BF2215D3850009B39B7 /* SizeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1A37BF1215D3850009B39B7 /* SizeExtensions.swift */; };
 		D1BA781D2174D07800C69D7B /* CallbackQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1BA781C2174D07800C69D7B /* CallbackQueue.swift */; };
 		D1BFED95222ACC6B009330C8 /* ImageProcessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1BFED94222ACC6B009330C8 /* ImageProcessorTests.swift */; };
@@ -255,7 +254,6 @@
 		D1A37BDD215D34E8009B39B7 /* ImageDrawing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageDrawing.swift; sourceTree = "<group>"; };
 		D1A37BE2215D359F009B39B7 /* ImageFormat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageFormat.swift; sourceTree = "<group>"; };
 		D1A37BE7215D365A009B39B7 /* ExtensionHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionHelpers.swift; sourceTree = "<group>"; };
-		D1A37BEC215D375F009B39B7 /* Deprecated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Deprecated.swift; sourceTree = "<group>"; };
 		D1A37BF1215D3850009B39B7 /* SizeExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SizeExtensions.swift; sourceTree = "<group>"; };
 		D1BA781C2174D07800C69D7B /* CallbackQueue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallbackQueue.swift; sourceTree = "<group>"; };
 		D1BFED94222ACC6B009330C8 /* ImageProcessorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageProcessorTests.swift; sourceTree = "<group>"; };
@@ -390,7 +388,6 @@
 				D12AB6B2215D2BB50013BA68 /* KingfisherError.swift */,
 				D12AB6B3215D2BB50013BA68 /* KingfisherManager.swift */,
 				D12AB6B4215D2BB50013BA68 /* KingfisherOptionsInfo.swift */,
-				D1A37BEC215D375F009B39B7 /* Deprecated.swift */,
 			);
 			path = General;
 			sourceTree = "<group>";
@@ -857,7 +854,6 @@
 				D1A37BDE215D34E8009B39B7 /* ImageDrawing.swift in Sources */,
 				4BD821672189FD330084CC21 /* SessionDataTask.swift in Sources */,
 				D12AB708215D2BB50013BA68 /* KingfisherError.swift in Sources */,
-				D1A37BED215D375F009B39B7 /* Deprecated.swift in Sources */,
 				4BE688F822FD513700B11168 /* WKInterfaceImage+Kingfisher.swift in Sources */,
 				D12AB724215D2BB50013BA68 /* Box.swift in Sources */,
 				4B8E291C216F40AA0095FAD1 /* AuthenticationChallengeResponsable.swift in Sources */,

+ 0 - 20
Sources/Cache/CacheSerializer.swift

@@ -52,26 +52,6 @@ public protocol CacheSerializer {
     /// - Returns: An image deserialized or `nil` when no valid image
     ///            could be deserialized.
     func image(with data: Data, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage?
-    
-    /// Gets an image deserialized from provided data.
-    ///
-    /// - Parameters:
-    ///   - data: The data from which an image should be deserialized.
-    ///   - options: Options for deserialization.
-    /// - Returns: An image deserialized or `nil` when no valid image
-    ///            could be deserialized.
-    /// - Note:
-    /// This method is deprecated. Please implement the version with
-    /// `KingfisherParsedOptionsInfo` as parameter instead.
-    @available(*, deprecated,
-    message: "Deprecated. Implement the method with same name but with `KingfisherParsedOptionsInfo` instead.")
-    func image(with data: Data, options: KingfisherOptionsInfo?) -> KFCrossPlatformImage?
-}
-
-extension CacheSerializer {
-    public func image(with data: Data, options: KingfisherOptionsInfo?) -> KFCrossPlatformImage? {
-        return image(with: data, options: KingfisherParsedOptionsInfo(options))
-    }
 }
 
 /// Represents a basic and default `CacheSerializer` used in Kingfisher disk cache system.

+ 0 - 27
Sources/Cache/ImageCache.swift

@@ -825,30 +825,3 @@ extension String {
         }
     }
 }
-
-extension ImageCache {
-
-    /// Creates an `ImageCache` with a given `name`, cache directory `path`
-    /// and a closure to modify the cache directory.
-    ///
-    /// - Parameters:
-    ///   - name: The name of cache object. It is used to setup disk cache directories and IO queue.
-    ///           You should not use the same `name` for different caches, otherwise, the disk storage would
-    ///           be conflicting to each other.
-    ///   - path: Location of cache URL on disk. It will be internally pass to the initializer of `DiskStorage` as the
-    ///           disk cache directory.
-    ///   - diskCachePathClosure: Closure that takes in an optional initial path string and generates
-    ///                           the final disk cache path. You could use it to fully customize your cache path.
-    /// - Throws: An error that happens during image cache creating, such as unable to create a directory at the given
-    ///           path.
-    @available(*, deprecated, message: "Use `init(name:cacheDirectoryURL:diskCachePathClosure:)` instead",
-    renamed: "init(name:cacheDirectoryURL:diskCachePathClosure:)")
-    public convenience init(
-        name: String,
-        path: String?,
-        diskCachePathClosure: DiskCachePathClosure? = nil) throws
-    {
-        let directoryURL = path.flatMap { URL(string: $0) }
-        try self.init(name: name, cacheDirectoryURL: directoryURL, diskCachePathClosure: diskCachePathClosure)
-    }
-}

+ 0 - 9
Sources/Extensions/ImageView+Kingfisher.swift

@@ -538,13 +538,4 @@ extension KFCrossPlatformImageView {
     @objc func shouldPreloadAllAnimation() -> Bool { return true }
 }
 
-extension KingfisherWrapper where Base: KFCrossPlatformImageView {
-    /// Gets the image URL bound to this image view.
-    @available(*, deprecated, message: "Use `taskIdentifier` instead to identify a setting task.")
-    public private(set) var webURL: URL? {
-        get { return nil }
-        set { }
-    }
-}
-
 #endif

+ 0 - 19
Sources/Extensions/NSButton+Kingfisher.swift

@@ -367,23 +367,4 @@ extension KingfisherWrapper where Base: NSButton {
         set { setRetainedAssociatedObject(base, &alternateImageTaskKey, newValue)}
     }
 }
-
-extension KingfisherWrapper where Base: NSButton {
-
-    /// Gets the image URL bound to this button.
-    @available(*, deprecated, message: "Use `taskIdentifier` instead to identify a setting task.")
-    public private(set) var webURL: URL? {
-        get { return nil }
-        set { }
-    }
-
-
-    /// Gets the image URL bound to this button.
-    @available(*, deprecated, message: "Use `alternateTaskIdentifier` instead to identify a setting task.")
-    public private(set) var alternateWebURL: URL? {
-        get { return nil }
-        set { }
-    }
-}
-
 #endif

+ 0 - 21
Sources/Extensions/UIButton+Kingfisher.swift

@@ -411,27 +411,6 @@ extension KingfisherWrapper where Base: UIButton {
         mutating set { setRetainedAssociatedObject(base, &backgroundImageTaskKey, newValue) }
     }
 }
-
-extension KingfisherWrapper where Base: UIButton {
-
-    /// Gets the image URL of this button for a specified state.
-    ///
-    /// - Parameter state: The state that uses the specified image.
-    /// - Returns: Current URL for image.
-    @available(*, deprecated, message: "Use `taskIdentifier` instead to identify a setting task.")
-    public func webURL(for state: UIControl.State) -> URL? {
-        return nil
-    }
-
-    /// Gets the background image URL of this button for a specified state.
-    ///
-    /// - Parameter state: The state that uses the specified background image.
-    /// - Returns: Current URL for image.
-    @available(*, deprecated, message: "Use `backgroundTaskIdentifier` instead to identify a setting task.")
-    public func backgroundWebURL(for state: UIControl.State) -> URL? {
-        return nil
-    }
-}
 #endif
 
 #endif

+ 0 - 10
Sources/Extensions/WKInterfaceImage+Kingfisher.swift

@@ -209,14 +209,4 @@ extension KingfisherWrapper where Base: WKInterfaceImage {
         set { setRetainedAssociatedObject(base, &imageTaskKey, newValue)}
     }
 }
-
-extension KingfisherWrapper where Base: WKInterfaceImage {
-    /// Gets the image URL bound to this image view.
-    @available(*, deprecated, message: "Use `taskIdentifier` instead to identify a setting task.")
-    public private(set) var webURL: URL? {
-        get { return nil }
-        set { }
-    }
-}
-
 #endif

+ 0 - 681
Sources/General/Deprecated.swift

@@ -1,681 +0,0 @@
-//
-//  Deprecated.swift
-//  Kingfisher
-//
-//  Created by onevcat on 2018/09/28.
-//
-//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>
-//
-//  Permission is hereby granted, free of charge, to any person obtaining a copy
-//  of this software and associated documentation files (the "Software"), to deal
-//  in the Software without restriction, including without limitation the rights
-//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-//  copies of the Software, and to permit persons to whom the Software is
-//  furnished to do so, subject to the following conditions:
-//
-//  The above copyright notice and this permission notice shall be included in
-//  all copies or substantial portions of the Software.
-//
-//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-//  THE SOFTWARE.
-
-#if canImport(AppKit) && !targetEnvironment(macCatalyst)
-import AppKit
-#elseif canImport(UIKit)
-import UIKit
-#endif
-
-// MARK: - Deprecated
-extension KingfisherWrapper where Base: KFCrossPlatformImage {
-    @available(*, deprecated, message:
-    "Will be removed soon. Pass parameters with `ImageCreatingOptions`, use `image(with:options:)` instead.")
-    public static func image(
-        data: Data,
-        scale: CGFloat,
-        preloadAllAnimationData: Bool,
-        onlyFirstFrame: Bool) -> KFCrossPlatformImage?
-    {
-        let options = ImageCreatingOptions(
-            scale: scale,
-            duration: 0.0,
-            preloadAll: preloadAllAnimationData,
-            onlyFirstFrame: onlyFirstFrame)
-        return KingfisherWrapper.image(data: data, options: options)
-    }
-    
-    @available(*, deprecated, message:
-    "Will be removed soon. Pass parameters with `ImageCreatingOptions`, use `animatedImage(with:options:)` instead.")
-    public static func animated(
-        with data: Data,
-        scale: CGFloat = 1.0,
-        duration: TimeInterval = 0.0,
-        preloadAll: Bool,
-        onlyFirstFrame: Bool = false) -> KFCrossPlatformImage?
-    {
-        let options = ImageCreatingOptions(
-            scale: scale, duration: duration, preloadAll: preloadAll, onlyFirstFrame: onlyFirstFrame)
-        return animatedImage(data: data, options: options)
-    }
-}
-
-@available(*, deprecated, message: "Will be removed soon. Use `Result<RetrieveImageResult>` based callback instead")
-public typealias CompletionHandler =
-    ((_ image: KFCrossPlatformImage?, _ error: NSError?, _ cacheType: CacheType, _ imageURL: URL?) -> Void)
-
-@available(*, deprecated, message: "Will be removed soon. Use `Result<ImageLoadingResult>` based callback instead")
-public typealias ImageDownloaderCompletionHandler =
-    ((_ image: KFCrossPlatformImage?, _ error: NSError?, _ url: URL?, _ originalData: Data?) -> Void)
-
-// MARK: - Deprecated
-@available(*, deprecated, message: "Will be removed soon. Use `DownloadTask` to cancel a task.")
-extension RetrieveImageTask {
-    @available(*, deprecated, message: "RetrieveImageTask.empty will be removed soon. Use `nil` to represent a no task.")
-    public static let empty = RetrieveImageTask()
-}
-
-// MARK: - Deprecated
-extension KingfisherManager {
-    /// Get an image with resource.
-    /// If `.empty` is used as `options`, Kingfisher will seek the image in memory and disk first.
-    /// If not found, it will download the image at `resource.downloadURL` and cache it with `resource.cacheKey`.
-    /// These default behaviors could be adjusted by passing different options. See `KingfisherOptions` for more.
-    ///
-    /// - Parameters:
-    ///   - resource: Resource object contains information such as `cacheKey` and `downloadURL`.
-    ///   - options: A dictionary could control some behaviors. See `KingfisherOptionsInfo` for more.
-    ///   - progressBlock: Called every time downloaded data changed. This could be used as a progress UI.
-    ///   - completionHandler: Called when the whole retrieving process finished.
-    /// - Returns: A `RetrieveImageTask` task object. You can use this object to cancel the task.
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    @discardableResult
-    public func retrieveImage(with resource: Resource,
-                              options: KingfisherOptionsInfo?,
-                              progressBlock: DownloadProgressBlock?,
-                              completionHandler: CompletionHandler?) -> DownloadTask?
-    {
-        return retrieveImage(with: resource, options: options, progressBlock: progressBlock) {
-            result in
-            switch result {
-            case .success(let value): completionHandler?(value.image, nil, value.cacheType, value.source.url)
-            case .failure(let error): completionHandler?(nil, error as NSError, .none, resource.downloadURL)
-            }
-        }
-    }
-}
-
-// MARK: - Deprecated
-extension ImageDownloader {
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    @discardableResult
-    open func downloadImage(with url: URL,
-                            retrieveImageTask: RetrieveImageTask? = nil,
-                            options: KingfisherOptionsInfo? = nil,
-                            progressBlock: ImageDownloaderProgressBlock? = nil,
-                            completionHandler: ImageDownloaderCompletionHandler?) -> DownloadTask?
-    {
-        return downloadImage(with: url, options: options, progressBlock: progressBlock) {
-            result in
-            switch result {
-            case .success(let value): completionHandler?(value.image, nil, value.url, value.originalData)
-            case .failure(let error): completionHandler?(nil, error as NSError, nil, nil)
-            }
-        }
-    }
-}
-
-@available(*, deprecated, message: "RetrieveImageDownloadTask is removed. Use `DownloadTask` to cancel a task.")
-public struct RetrieveImageDownloadTask {
-}
-
-@available(*, deprecated, message: "RetrieveImageTask is removed. Use `DownloadTask` to cancel a task.")
-public final class RetrieveImageTask {
-}
-
-@available(*, deprecated, message: "Use `DownloadProgressBlock` instead.", renamed: "DownloadProgressBlock")
-public typealias ImageDownloaderProgressBlock = DownloadProgressBlock
-
-#if !os(watchOS)
-// MARK: - Deprecated
-extension KingfisherWrapper where Base: KFCrossPlatformImageView {
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    @discardableResult
-    public func setImage(with resource: Resource?,
-                         placeholder: Placeholder? = nil,
-                         options: KingfisherOptionsInfo? = nil,
-                         progressBlock: DownloadProgressBlock? = nil,
-                         completionHandler: CompletionHandler?) -> DownloadTask?
-    {
-        return setImage(with: resource, placeholder: placeholder, options: options, progressBlock: progressBlock) {
-            result in
-            switch result {
-            case .success(let value):
-                completionHandler?(value.image, nil, value.cacheType, value.source.url)
-            case .failure(let error):
-                completionHandler?(nil, error as NSError, .none, nil)
-            }
-        }
-    }
-}
-#endif
-
-#if canImport(UIKit) && !os(watchOS)
-// MARK: - Deprecated
-extension KingfisherWrapper where Base: UIButton {
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    @discardableResult
-    public func setImage(
-        with resource: Resource?,
-        for state: UIControl.State,
-        placeholder: UIImage? = nil,
-        options: KingfisherOptionsInfo? = nil,
-        progressBlock: DownloadProgressBlock? = nil,
-        completionHandler: CompletionHandler?) -> DownloadTask?
-    {
-        return setImage(
-            with: resource,
-            for: state,
-            placeholder: placeholder,
-            options: options,
-            progressBlock: progressBlock)
-        {
-            result in
-            switch result {
-            case .success(let value):
-                completionHandler?(value.image, nil, value.cacheType, value.source.url)
-            case .failure(let error):
-                completionHandler?(nil, error as NSError, .none, nil)
-            }
-        }
-    }
-    
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    @discardableResult
-    public func setBackgroundImage(
-        with resource: Resource?,
-        for state: UIControl.State,
-        placeholder: UIImage? = nil,
-        options: KingfisherOptionsInfo? = nil,
-        progressBlock: DownloadProgressBlock? = nil,
-        completionHandler: CompletionHandler?) -> DownloadTask?
-    {
-        return setBackgroundImage(
-            with: resource,
-            for: state,
-            placeholder: placeholder,
-            options: options,
-            progressBlock: progressBlock)
-        {
-            result in
-            switch result {
-            case .success(let value):
-                completionHandler?(value.image, nil, value.cacheType, value.source.url)
-            case .failure(let error):
-                completionHandler?(nil, error as NSError, .none, nil)
-            }
-        }
-    }
-}
-#endif
-
-#if os(watchOS)
-import WatchKit
-// MARK: - Deprecated
-extension KingfisherWrapper where Base: WKInterfaceImage {
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    @discardableResult
-    public func setImage(_ resource: Resource?,
-                         placeholder: KFCrossPlatformImage? = nil,
-                         options: KingfisherOptionsInfo? = nil,
-                         progressBlock: DownloadProgressBlock? = nil,
-                         completionHandler: CompletionHandler?) -> DownloadTask?
-    {
-        return setImage(
-            with: resource,
-            placeholder: placeholder,
-            options: options,
-            progressBlock: progressBlock)
-        {
-            result in
-            switch result {
-            case .success(let value):
-                completionHandler?(value.image, nil, value.cacheType, value.source.url)
-            case .failure(let error):
-                completionHandler?(nil, error as NSError, .none, nil)
-            }
-        }
-    }
-}
-#endif
-
-#if os(macOS)
-// MARK: - Deprecated
-extension KingfisherWrapper where Base: NSButton {
-    @discardableResult
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    public func setImage(with resource: Resource?,
-                         placeholder: KFCrossPlatformImage? = nil,
-                         options: KingfisherOptionsInfo? = nil,
-                         progressBlock: DownloadProgressBlock? = nil,
-                         completionHandler: CompletionHandler?) -> DownloadTask?
-    {
-        return setImage(
-            with: resource,
-            placeholder: placeholder,
-            options: options,
-            progressBlock: progressBlock)
-        {
-            result in
-            switch result {
-            case .success(let value):
-                completionHandler?(value.image, nil, value.cacheType, value.source.url)
-            case .failure(let error):
-                completionHandler?(nil, error as NSError, .none, nil)
-            }
-        }
-    }
-    
-    @discardableResult
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    public func setAlternateImage(with resource: Resource?,
-                                  placeholder: KFCrossPlatformImage? = nil,
-                                  options: KingfisherOptionsInfo? = nil,
-                                  progressBlock: DownloadProgressBlock? = nil,
-                                  completionHandler: CompletionHandler?) -> DownloadTask?
-    {
-        return setAlternateImage(
-            with: resource,
-            placeholder: placeholder,
-            options: options,
-            progressBlock: progressBlock)
-        {
-            result in
-            switch result {
-            case .success(let value):
-                completionHandler?(value.image, nil, value.cacheType, value.source.url)
-            case .failure(let error):
-                completionHandler?(nil, error as NSError, .none, nil)
-            }
-        }
-    }
-}
-#endif
-
-// MARK: - Deprecated
-extension ImageCache {
-    /// The largest cache cost of memory cache. The total cost is pixel count of
-    /// all cached images in memory.
-    /// Default is unlimited. Memory cache will be purged automatically when a
-    /// memory warning notification is received.
-    @available(*, deprecated, message: "Use `memoryStorage.config.totalCostLimit` instead.",
-    renamed: "memoryStorage.config.totalCostLimit")
-    open var maxMemoryCost: Int {
-        get { return memoryStorage.config.totalCostLimit }
-        set { memoryStorage.config.totalCostLimit = newValue }
-    }
-
-    /// The default DiskCachePathClosure
-    @available(*, deprecated, message: "Not needed anymore.")
-    public final class func defaultDiskCachePathClosure(path: String?, cacheName: String) -> String {
-        let dstPath = path ?? NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first!
-        return (dstPath as NSString).appendingPathComponent(cacheName)
-    }
-
-    /// The default file extension appended to cached files.
-    @available(*, deprecated, message: "Use `diskStorage.config.pathExtension` instead.",
-    renamed: "diskStorage.config.pathExtension")
-    open var pathExtension: String? {
-        get { return diskStorage.config.pathExtension }
-        set { diskStorage.config.pathExtension = newValue }
-    }
-    
-    ///The disk cache location.
-    @available(*, deprecated, message: "Use `diskStorage.directoryURL.absoluteString` instead.",
-    renamed: "diskStorage.directoryURL.absoluteString")
-    public var diskCachePath: String {
-        return diskStorage.directoryURL.absoluteString
-    }
-    
-    /// The largest disk size can be taken for the cache. It is the total
-    /// allocated size of cached files in bytes.
-    /// Default is no limit.
-    @available(*, deprecated, message: "Use `diskStorage.config.sizeLimit` instead.",
-    renamed: "diskStorage.config.sizeLimit")
-    open var maxDiskCacheSize: UInt {
-        get { return UInt(diskStorage.config.sizeLimit) }
-        set { diskStorage.config.sizeLimit = newValue }
-    }
-    
-    @available(*, deprecated, message: "Use `diskStorage.cacheFileURL(forKey:).path` instead.",
-    renamed: "diskStorage.cacheFileURL(forKey:)")
-    open func cachePath(forComputedKey key: String) -> String {
-        return diskStorage.cacheFileURL(forKey: key).path
-    }
-    
-    /**
-     Get an image for a key from disk.
-     
-     - parameter key:     Key for the image.
-     - parameter options: Options of retrieving image. If you need to retrieve an image which was
-     stored with a specified `ImageProcessor`, pass the processor in the option too.
-     
-     - returns: The image object if it is cached, or `nil` if there is no such key in the cache.
-     */
-    @available(*, deprecated,
-    message: "Use `Result` based `retrieveImageInDiskCache(forKey:options:callbackQueue:completionHandler:)` instead.",
-    renamed: "retrieveImageInDiskCache(forKey:options:callbackQueue:completionHandler:)")
-    open func retrieveImageInDiskCache(forKey key: String, options: KingfisherOptionsInfo? = nil) -> KFCrossPlatformImage? {
-        let options = KingfisherParsedOptionsInfo(options ?? .empty)
-        let computedKey = key.computedKey(with: options.processor.identifier)
-        do {
-            if let data = try diskStorage.value(forKey: computedKey, extendingExpiration: options.diskCacheAccessExtendingExpiration) {
-                return options.cacheSerializer.image(with: data, options: options)
-            }
-        } catch {}
-        return nil
-    }
-
-    @available(*, deprecated,
-    message: "Use `Result` based `retrieveImage(forKey:options:callbackQueue:completionHandler:)` instead.",
-    renamed: "retrieveImage(forKey:options:callbackQueue:completionHandler:)")
-    open func retrieveImage(forKey key: String,
-                            options: KingfisherOptionsInfo?,
-                            completionHandler: ((KFCrossPlatformImage?, CacheType) -> Void)?)
-    {
-        retrieveImage(
-            forKey: key,
-            options: options,
-            callbackQueue: .dispatch((options ?? .empty).callbackDispatchQueue))
-        {
-            result in
-            do {
-                let value = try result.get()
-                completionHandler?(value.image, value.cacheType)
-            } catch {
-                completionHandler?(nil, .none)
-            }
-        }
-    }
-
-    /// The longest time duration in second of the cache being stored in disk.
-    /// Default is 1 week (60 * 60 * 24 * 7 seconds).
-    /// Setting this to a negative value will make the disk cache never expiring.
-    @available(*, deprecated, message: "Deprecated. Use `diskStorage.config.expiration` instead")
-    open var maxCachePeriodInSecond: TimeInterval {
-        get { return diskStorage.config.expiration.timeInterval }
-        set { diskStorage.config.expiration = newValue < 0 ? .never : .seconds(newValue) }
-    }
-
-    @available(*, deprecated, message: "Use `Result` based callback instead.")
-    open func store(_ image: KFCrossPlatformImage,
-                    original: Data? = nil,
-                    forKey key: String,
-                    processorIdentifier identifier: String = "",
-                    cacheSerializer serializer: CacheSerializer = DefaultCacheSerializer.default,
-                    toDisk: Bool = true,
-                    completionHandler: (() -> Void)?)
-    {
-        store(
-            image,
-            original: original,
-            forKey: key,
-            processorIdentifier: identifier,
-            cacheSerializer: serializer,
-            toDisk: toDisk)
-        {
-            _ in
-            completionHandler?()
-        }
-    }
-
-    @available(*, deprecated, message: "Use the `Result`-based `calculateDiskStorageSize` instead.")
-    open func calculateDiskCacheSize(completion handler: @escaping ((_ size: UInt) -> Void)) {
-        calculateDiskStorageSize { result in
-            let size: UInt? = try? result.get()
-            handler(size ?? 0)
-        }
-    }
-}
-
-// MARK: - Deprecated
-extension Collection where Iterator.Element == KingfisherOptionsInfoItem {
-    /// The queue of callbacks should happen from Kingfisher.
-    @available(*, deprecated, message: "Use `callbackQueue` instead.", renamed: "callbackQueue")
-    public var callbackDispatchQueue: DispatchQueue {
-        return KingfisherParsedOptionsInfo(Array(self)).callbackQueue.queue
-    }
-}
-
-/// Error domain of Kingfisher
-@available(*, deprecated, message: "Use `KingfisherError.domain` instead.", renamed: "KingfisherError.domain")
-public let KingfisherErrorDomain = "com.onevcat.Kingfisher.Error"
-
-/// Key will be used in the `userInfo` of `.invalidStatusCode`
-@available(*, unavailable,
-message: "Use `.invalidHTTPStatusCode` or `isInvalidResponseStatusCode` of `KingfisherError` instead for the status code.")
-public let KingfisherErrorStatusCodeKey = "statusCode"
-
-// MARK: - Deprecated
-extension Collection where Iterator.Element == KingfisherOptionsInfoItem {
-    /// The target `ImageCache` which is used.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `targetCache` instead.")
-    public var targetCache: ImageCache? {
-        return KingfisherParsedOptionsInfo(Array(self)).targetCache
-    }
-
-    /// The original `ImageCache` which is used.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `originalCache` instead.")
-    public var originalCache: ImageCache? {
-        return KingfisherParsedOptionsInfo(Array(self)).originalCache
-    }
-
-    /// The `ImageDownloader` which is specified.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `downloader` instead.")
-    public var downloader: ImageDownloader? {
-        return KingfisherParsedOptionsInfo(Array(self)).downloader
-    }
-
-    /// Member for animation transition when using UIImageView.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `transition` instead.")
-    public var transition: ImageTransition {
-        return KingfisherParsedOptionsInfo(Array(self)).transition
-    }
-
-    /// A `Float` value set as the priority of image download task. The value for it should be
-    /// between 0.0~1.0.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `downloadPriority` instead.")
-    public var downloadPriority: Float {
-        return KingfisherParsedOptionsInfo(Array(self)).downloadPriority
-    }
-
-    /// Whether an image will be always downloaded again or not.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `forceRefresh` instead.")
-    public var forceRefresh: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).forceRefresh
-    }
-
-    /// Whether an image should be got only from memory cache or download.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `fromMemoryCacheOrRefresh` instead.")
-    public var fromMemoryCacheOrRefresh: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).fromMemoryCacheOrRefresh
-    }
-
-    /// Whether the transition should always happen or not.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `forceTransition` instead.")
-    public var forceTransition: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).forceTransition
-    }
-
-    /// Whether cache the image only in memory or not.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `cacheMemoryOnly` instead.")
-    public var cacheMemoryOnly: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).cacheMemoryOnly
-    }
-
-    /// Whether the caching operation will be waited or not.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `waitForCache` instead.")
-    public var waitForCache: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).waitForCache
-    }
-
-    /// Whether only load the images from cache or not.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `onlyFromCache` instead.")
-    public var onlyFromCache: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).onlyFromCache
-    }
-
-    /// Whether the image should be decoded in background or not.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `backgroundDecode` instead.")
-    public var backgroundDecode: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).backgroundDecode
-    }
-
-    /// Whether the image data should be all loaded at once if it is an animated image.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `preloadAllAnimationData` instead.")
-    public var preloadAllAnimationData: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).preloadAllAnimationData
-    }
-
-    /// The `CallbackQueue` on which completion handler should be invoked.
-    /// If not set in the options, `.mainCurrentOrAsync` will be used.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `callbackQueue` instead.")
-    public var callbackQueue: CallbackQueue {
-        return KingfisherParsedOptionsInfo(Array(self)).callbackQueue
-    }
-
-    /// The scale factor which should be used for the image.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `scaleFactor` instead.")
-    public var scaleFactor: CGFloat {
-        return KingfisherParsedOptionsInfo(Array(self)).scaleFactor
-    }
-
-    /// The `ImageDownloadRequestModifier` will be used before sending a download request.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `requestModifier` instead.")
-    public var modifier: ImageDownloadRequestModifier? {
-        return KingfisherParsedOptionsInfo(Array(self)).requestModifier
-    }
-
-    /// `ImageProcessor` for processing when the downloading finishes.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `processor` instead.")
-    public var processor: ImageProcessor {
-        return KingfisherParsedOptionsInfo(Array(self)).processor
-    }
-
-    /// `ImageModifier` for modifying right before the image is displayed.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `imageModifier` instead.")
-    public var imageModifier: ImageModifier? {
-        return KingfisherParsedOptionsInfo(Array(self)).imageModifier
-    }
-
-    /// `CacheSerializer` to convert image to data for storing in cache.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `cacheSerializer` instead.")
-    public var cacheSerializer: CacheSerializer {
-        return KingfisherParsedOptionsInfo(Array(self)).cacheSerializer
-    }
-
-    /// Keep the existing image while setting another image to an image view.
-    /// Or the placeholder will be used while downloading.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `keepCurrentImageWhileLoading` instead.")
-    public var keepCurrentImageWhileLoading: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).keepCurrentImageWhileLoading
-    }
-
-    /// Whether the options contains `.onlyLoadFirstFrame`.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `onlyLoadFirstFrame` instead.")
-    public var onlyLoadFirstFrame: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).onlyLoadFirstFrame
-    }
-
-    /// Whether the options contains `.cacheOriginalImage`.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `cacheOriginalImage` instead.")
-    public var cacheOriginalImage: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).cacheOriginalImage
-    }
-
-    /// The image which should be used when download image request fails.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `onFailureImage` instead.")
-    public var onFailureImage: Optional<KFCrossPlatformImage?> {
-        return KingfisherParsedOptionsInfo(Array(self)).onFailureImage
-    }
-
-    /// Whether the `ImagePrefetcher` should load images to memory in an aggressive way or not.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `alsoPrefetchToMemory` instead.")
-    public var alsoPrefetchToMemory: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).alsoPrefetchToMemory
-    }
-
-    /// Whether the disk storage file loading should happen in a synchronous behavior or not.
-    @available(*, deprecated,
-    message: "Create a `KingfisherParsedOptionsInfo` from `KingfisherOptionsInfo` and use `loadDiskFileSynchronously` instead.")
-    public var loadDiskFileSynchronously: Bool {
-        return KingfisherParsedOptionsInfo(Array(self)).loadDiskFileSynchronously
-    }
-}
-
-/// The default modifier.
-/// It does nothing and returns the image as is.
-@available(*, deprecated, message: "Use `nil` in KingfisherOptionsInfo to indicate no modifier.")
-public struct DefaultImageModifier: ImageModifier {
-
-    /// A default `DefaultImageModifier` which can be used everywhere.
-    public static let `default` = DefaultImageModifier()
-    private init() {}
-
-    /// Modifies an input `Image`. See `ImageModifier` protocol for more.
-    public func modify(_ image: KFCrossPlatformImage) -> KFCrossPlatformImage { return image }
-}
-
-
-#if os(macOS)
-@available(*, deprecated, message: "Use `KFCrossPlatformImage` instead.")
-public typealias Image = KFCrossPlatformImage
-@available(*, deprecated, message: "Use `KFCrossPlatformView` instead.")
-public typealias View = KFCrossPlatformView
-@available(*, deprecated, message: "Use `KFCrossPlatformColor` instead.")
-public typealias Color = KFCrossPlatformColor
-@available(*, deprecated, message: "Use `KFCrossPlatformImageView` instead.")
-public typealias ImageView = KFCrossPlatformImageView
-@available(*, deprecated, message: "Use `KFCrossPlatformButton` instead.")
-public typealias Button = KFCrossPlatformButton
-#else
-@available(*, deprecated, message: "Use `KFCrossPlatformImage` instead.")
-public typealias Image = KFCrossPlatformImage
-@available(*, deprecated, message: "Use `KFCrossPlatformColor` instead.")
-public typealias Color = KFCrossPlatformColor
-    #if !os(watchOS)
-    @available(*, deprecated, message: "Use `KFCrossPlatformImageView` instead.")
-    public typealias ImageView = KFCrossPlatformImageView
-    @available(*, deprecated, message: "Use `KFCrossPlatformView` instead.")
-    public typealias View = KFCrossPlatformView
-    @available(*, deprecated, message: "Use `KFCrossPlatformButton` instead.")
-    public typealias Button = KFCrossPlatformButton
-    #endif
-#endif

+ 0 - 6
Sources/General/KingfisherOptionsInfo.swift

@@ -99,11 +99,6 @@ public enum KingfisherOptionsInfoItem {
     /// rendering to extract pixel information in background. This can speed up display, but will cost more time to
     /// prepare the image for using.
     case backgroundDecode
-    
-    /// The associated value of this member will be used as the target queue of dispatch callbacks when
-    /// retrieving images from cache. If not set, Kingfisher will use main queue for callbacks.
-    @available(*, deprecated, message: "Use `.callbackQueue(CallbackQueue)` instead.")
-    case callbackDispatchQueue(DispatchQueue?)
 
     /// The associated value will be used as the target queue of dispatch callbacks when retrieving images from
     /// cache. If not set, Kingfisher will use `.mainCurrentOrAsync` for callbacks.
@@ -329,7 +324,6 @@ public struct KingfisherParsedOptionsInfo {
             case .onFailureImage(let value): onFailureImage = .some(value)
             case .alsoPrefetchToMemory: alsoPrefetchToMemory = true
             case .loadDiskFileSynchronously: loadDiskFileSynchronously = true
-            case .callbackDispatchQueue(let value): callbackQueue = value.map { .dispatch($0) } ?? .mainCurrentOrAsync
             case .memoryCacheExpiration(let expiration): memoryCacheExpiration = expiration
             case .memoryCacheAccessExtendingExpiration(let expirationExtending): memoryCacheAccessExtendingExpiration = expirationExtending
             case .diskCacheExpiration(let expiration): diskCacheExpiration = expiration

+ 0 - 52
Sources/Image/ImageProcessor.swift

@@ -59,27 +59,6 @@ public protocol ImageProcessor {
     /// the `DefaultImageProcessor`. It is recommended to use a reverse domain name notation string of
     /// your own for the identifier.
     var identifier: String { get }
-    
-    /// Processes the input `ImageProcessItem` with this processor.
-    ///
-    /// - Parameters:
-    ///   - item: Input item which will be processed by `self`.
-    ///   - options: Options when processing the item.
-    /// - Returns: The processed image.
-    ///
-    /// - Note: The return value should be `nil` if processing failed while converting an input item to image.
-    ///         If `nil` received by the processing caller, an error will be reported and the process flow stops.
-    ///         If the processing flow is not critical for your flow, then when the input item is already an image
-    ///         (`.image` case) and there is any errors in the processing, you could return the input image itself
-    ///         to keep the processing pipeline continuing.
-    /// - Note: Most processor only supports CG-based images. watchOS is not supported for processors containing
-    ///         a filter, the input image will be returned directly on watchOS.
-    /// - Note:
-    /// This method is deprecated. Please implement the version with
-    /// `KingfisherParsedOptionsInfo` as parameter instead.
-    @available(*, deprecated,
-    message: "Deprecated. Implement the method with same name but with `KingfisherParsedOptionsInfo` instead.")
-    func process(item: ImageProcessItem, options: KingfisherOptionsInfo) -> KFCrossPlatformImage?
 
     /// Processes the input `ImageProcessItem` with this processor.
     ///
@@ -98,12 +77,6 @@ public protocol ImageProcessor {
     func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage?
 }
 
-extension ImageProcessor {
-    public func process(item: ImageProcessItem, options: KingfisherOptionsInfo) -> KFCrossPlatformImage? {
-        return process(item: item, options: KingfisherParsedOptionsInfo(options))
-    }
-}
-
 extension ImageProcessor {
     
     /// Appends an `ImageProcessor` to another. The identifier of the new `ImageProcessor`
@@ -371,18 +344,6 @@ public struct RoundCornerImageProcessor: ImageProcessor {
     /// - Note: See documentation of `ImageProcessor` protocol for more.
     public let identifier: String
 
-    /// Corner radius will be applied in processing. To provide backward compatibility, this property returns `0` unless
-    /// `Radius.point` is specified.
-    @available(*, deprecated, message: "Use `radius` property instead.")
-    public var cornerRadius: CGFloat {
-        switch radius {
-        case .widthFraction, .heightFraction:
-            return 0.0
-        case .point(let value):
-            return value
-        }
-    }
-
     /// The radius will be applied in processing. Specify a certain point value with `.point`, or a fraction of the
     /// target image with `.widthFraction`. or `.heightFraction`. For example, given a square image with width and
     /// height equals,  `.widthFraction(0.5)` means use half of the length of size and makes the final image a round one.
@@ -882,19 +843,6 @@ public struct DownsamplingImageProcessor: ImageProcessor {
     }
 }
 
-/// Concatenates two `ImageProcessor`s. `ImageProcessor.append(another:)` is used internally.
-///
-/// - Parameters:
-///   - left: The first processor.
-///   - right: The second processor.
-/// - Returns: The concatenated processor.
-@available(*, deprecated,
-message: "Will be removed soon. Use `|>` instead.",
-renamed: "|>")
-public func >>(left: ImageProcessor, right: ImageProcessor) -> ImageProcessor {
-    return left.append(another: right)
-}
-
 infix operator |>: AdditionPrecedence
 public func |>(left: ImageProcessor, right: ImageProcessor) -> ImageProcessor {
     return left.append(another: right)

+ 0 - 14
Sources/Utility/Result.swift

@@ -141,20 +141,6 @@ extension Result where Failure: Error {
             throw failure
         }
     }
-
-    /// Unwraps the `Result` into a throwing expression.
-    ///
-    /// - Returns: The success value, if the instance is a success.
-    /// - Throws:  The error value, if the instance is a failure.
-    @available(*, deprecated, message: "This method will be removed soon. Use `get() throws -> Success` instead.")
-    public func unwrapped() throws -> Success {
-        switch self {
-        case let .success(value):
-            return value
-        case let .failure(error):
-            throw error
-        }
-    }
 }
 
 extension Result where Failure == Swift.Error {