|
|
@@ -47,35 +47,41 @@ extension Resource {
|
|
|
let key = overrideCacheKey ?? cacheKey
|
|
|
return downloadURL.isFileURL ?
|
|
|
.provider(LocalFileImageDataProvider(fileURL: downloadURL, cacheKey: key)) :
|
|
|
- .network(ImageResource(downloadURL: downloadURL, cacheKey: key))
|
|
|
+ .network(KF.ImageResource(downloadURL: downloadURL, cacheKey: key))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/// ImageResource is a simple combination of `downloadURL` and `cacheKey`.
|
|
|
-/// When passed to image view set methods, Kingfisher will try to download the target
|
|
|
-/// image from the `downloadURL`, and then store it with the `cacheKey` as the key in cache.
|
|
|
-public struct ImageResource: Resource {
|
|
|
+@available(*, deprecated, message: "This type conflicts with `GeneratedAssetSymbols.ImageResource` in Swift 5.9. Renamed to avoid issues in the future.", renamed: "KF.ImageResource")
|
|
|
+public typealias ImageResource = KF.ImageResource
|
|
|
|
|
|
- // MARK: - Initializers
|
|
|
|
|
|
- /// Creates an image resource.
|
|
|
- ///
|
|
|
- /// - Parameters:
|
|
|
- /// - downloadURL: The target image URL from where the image can be downloaded.
|
|
|
- /// - cacheKey: The cache key. If `nil`, Kingfisher will use the `absoluteString` of `downloadURL` as the key.
|
|
|
- /// Default is `nil`.
|
|
|
- public init(downloadURL: URL, cacheKey: String? = nil) {
|
|
|
- self.downloadURL = downloadURL
|
|
|
- self.cacheKey = cacheKey ?? downloadURL.cacheKey
|
|
|
- }
|
|
|
+extension KF {
|
|
|
+ /// ImageResource is a simple combination of `downloadURL` and `cacheKey`.
|
|
|
+ /// When passed to image view set methods, Kingfisher will try to download the target
|
|
|
+ /// image from the `downloadURL`, and then store it with the `cacheKey` as the key in cache.
|
|
|
+ public struct ImageResource: Resource {
|
|
|
|
|
|
- // MARK: Protocol Conforming
|
|
|
-
|
|
|
- /// The key used in cache.
|
|
|
- public let cacheKey: String
|
|
|
+ // MARK: - Initializers
|
|
|
|
|
|
- /// The target image URL.
|
|
|
- public let downloadURL: URL
|
|
|
+ /// Creates an image resource.
|
|
|
+ ///
|
|
|
+ /// - Parameters:
|
|
|
+ /// - downloadURL: The target image URL from where the image can be downloaded.
|
|
|
+ /// - cacheKey: The cache key. If `nil`, Kingfisher will use the `absoluteString` of `downloadURL` as the key.
|
|
|
+ /// Default is `nil`.
|
|
|
+ public init(downloadURL: URL, cacheKey: String? = nil) {
|
|
|
+ self.downloadURL = downloadURL
|
|
|
+ self.cacheKey = cacheKey ?? downloadURL.cacheKey
|
|
|
+ }
|
|
|
+
|
|
|
+ // MARK: Protocol Conforming
|
|
|
+
|
|
|
+ /// The key used in cache.
|
|
|
+ public let cacheKey: String
|
|
|
+
|
|
|
+ /// The target image URL.
|
|
|
+ public let downloadURL: URL
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// URL conforms to `Resource` in Kingfisher.
|