Ver Fonte

Mark sendable for closures

onevcat há 1 ano atrás
pai
commit
3bca097fbe

+ 1 - 1
Sources/Cache/ImageCache.swift

@@ -180,7 +180,7 @@ open class ImageCache {
     private let ioQueue: DispatchQueue
     
     /// A closure that specifies the disk cache path based on a given path and the cache name.
-    public typealias DiskCachePathClosure = (URL, String) -> URL
+    public typealias DiskCachePathClosure = @Sendable (URL, String) -> URL
 
     // MARK: Initializers
 

+ 2 - 2
Sources/Networking/RequestModifier.swift

@@ -127,7 +127,7 @@ extension ImageDownloadRequestModifier {
 /// This type conforms to ``ImageDownloadRequestModifier`` and wraps an image modification block.
 public struct AnyModifier: ImageDownloadRequestModifier {
     
-    let block: (URLRequest) -> URLRequest?
+    let block: @Sendable (URLRequest) -> URLRequest?
 
     public func modified(for request: URLRequest) -> URLRequest? {
         return block(request)
@@ -136,7 +136,7 @@ public struct AnyModifier: ImageDownloadRequestModifier {
     /// Creates a value of ``ImageDownloadRequestModifier`` that runs the `modify` block.
     ///
     /// - Parameter modify: The request modifying block runs when a request modifying task comes.
-    public init(modify: @escaping (URLRequest) -> URLRequest?) {
+    public init(modify: @escaping @Sendable (URLRequest) -> URLRequest?) {
         block = modify
     }
 }