|
|
@@ -23,6 +23,7 @@
|
|
|
//
|
|
|
|
|
|
#if compiler(>=5.6.0) && canImport(_Concurrency)
|
|
|
+// swiftformat:options --swiftversion 5.6
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
@@ -112,7 +113,7 @@ extension Request {
|
|
|
|
|
|
/// Value used to `await` a `DataResponse` and associated values.
|
|
|
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
|
|
-public struct DataTask<Value> {
|
|
|
+public struct DataTask<Value: Sendable>: Sendable {
|
|
|
/// `DataResponse` produced by the `DataRequest` and its response handler.
|
|
|
public var response: DataResponse<Value, AFError> {
|
|
|
get async {
|
|
|
@@ -283,7 +284,7 @@ extension DataRequest {
|
|
|
}
|
|
|
|
|
|
private func dataTask<Value>(automaticallyCancelling shouldAutomaticallyCancel: Bool,
|
|
|
- forResponse onResponse: @escaping (@escaping (DataResponse<Value, AFError>) -> Void) -> Void)
|
|
|
+ forResponse onResponse: @Sendable @escaping (@escaping (DataResponse<Value, AFError>) -> Void) -> Void)
|
|
|
-> DataTask<Value> {
|
|
|
let task = Task {
|
|
|
await withTaskCancellationHandler {
|
|
|
@@ -305,7 +306,7 @@ extension DataRequest {
|
|
|
|
|
|
/// Value used to `await` a `DownloadResponse` and associated values.
|
|
|
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
|
|
-public struct DownloadTask<Value> {
|
|
|
+public struct DownloadTask<Value: Sendable>: Sendable {
|
|
|
/// `DownloadResponse` produced by the `DownloadRequest` and its response handler.
|
|
|
public var response: DownloadResponse<Value, AFError> {
|
|
|
get async {
|
|
|
@@ -492,7 +493,7 @@ extension DownloadRequest {
|
|
|
}
|
|
|
|
|
|
private func downloadTask<Value>(automaticallyCancelling shouldAutomaticallyCancel: Bool,
|
|
|
- forResponse onResponse: @escaping (@escaping (DownloadResponse<Value, AFError>) -> Void) -> Void)
|
|
|
+ forResponse onResponse: @Sendable @escaping (@escaping (DownloadResponse<Value, AFError>) -> Void) -> Void)
|
|
|
-> DownloadTask<Value> {
|
|
|
let task = Task {
|
|
|
await withTaskCancellationHandler {
|
|
|
@@ -701,4 +702,5 @@ public struct StreamOf<Element>: AsyncSequence {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// swiftformat:options --swiftversion 5.6
|
|
|
#endif
|