Skip to content

Commit 83d191c

Browse files
committed
fix: add @unchecked Sendable annotations for warnings
1 parent 50afae2 commit 83d191c

27 files changed

+97
-39
lines changed

Amplify/Categories/API/Operation/GraphQLOperation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ open class GraphQLOperation<R: Decodable>: AmplifyOperation<
1010
GraphQLOperationRequest<R>,
1111
GraphQLResponse<R>,
1212
APIError
13-
> { }
13+
>, @unchecked Sendable { }
1414

1515
/// GraphQL Subscription Operation
1616
open class GraphQLSubscriptionOperation<R: Decodable>: AmplifyInProcessReportingOperation<
1717
GraphQLOperationRequest<R>,
1818
GraphQLSubscriptionEvent<R>,
1919
Void,
2020
APIError
21-
> { }
21+
>, @unchecked Sendable { }
2222

2323
public extension HubPayload.EventName.API {
2424
/// eventName for HubPayloads emitted by this operation

Amplify/Categories/API/Response/SubscriptionEvent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
/// Event for subscription
9-
public enum GraphQLSubscriptionEvent<T: Decodable> {
9+
public enum GraphQLSubscriptionEvent<T> where T:Decodable, T:Sendable {
1010
/// The subscription's connection state has changed.
1111
case connection(SubscriptionConnectionState)
1212

Amplify/Categories/DataStore/Subscribe/DataStoreQuerySnapshot.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99

1010
/// A snapshot of the items from DataStore, the changes since last snapshot, and whether this model has
1111
/// finished syncing and subscriptions are active
12-
public struct DataStoreQuerySnapshot<M: Model> {
12+
public struct DataStoreQuerySnapshot<M> where M:Model, M:Sendable {
1313

1414
/// All model instances from the local store
1515
public let items: [M]
@@ -22,5 +22,3 @@ public struct DataStoreQuerySnapshot<M: Model> {
2222
self.isSynced = isSynced
2323
}
2424
}
25-
26-
extension DataStoreQuerySnapshot: Sendable { }

Amplify/Core/Support/AmplifyInProcessReportingOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ open class AmplifyInProcessReportingOperation<
2222
InProcess,
2323
Success,
2424
Failure: AmplifyError
25-
>: AmplifyOperation<Request, Success, Failure> {
25+
>: AmplifyOperation<Request, Success, Failure>, @unchecked Sendable {
2626
public typealias InProcess = InProcess
2727

2828
var inProcessListenerUnsubscribeToken: UnsubscribeToken?

Amplify/Core/Support/AmplifyOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Foundation
1616
/// implementation of a `dispatch` method that sends a contextualized payload to the Hub.
1717
///
1818
/// Pausable/resumable tasks that do not require Hub dispatching should use AsynchronousOperation instead.
19-
open class AmplifyOperation<Request: AmplifyOperationRequest, Success, Failure: AmplifyError>: AsynchronousOperation {
19+
open class AmplifyOperation<Request: AmplifyOperationRequest, Success, Failure: AmplifyError>: AsynchronousOperation, @unchecked Sendable {
2020

2121
/// The concrete Request associated with this operation
2222
public typealias Request = Request

Amplify/Core/Support/AsychronousOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Foundation
1212
/// from the OperationQueue after it has completed all its work. This class is not inherently thread safe. Although it
1313
/// is a subclass of Foundation's Operation, it contains private state to support pausing, resuming, and finishing, that
1414
/// must be managed by callers.
15-
open class AsynchronousOperation: Operation {
15+
open class AsynchronousOperation: Operation, @unchecked Sendable {
1616

1717
/// State for this operation.
1818
@objc private enum OperationState: Int {

Amplify/DefaultPlugins/AWSHubPlugin/Internal/HubChannelDispatcher.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protocol HubDispatchOperationDelegate: AnyObject {
8585
var listeners: [FilteredListener] { get }
8686
}
8787

88-
final class HubDispatchOperation: Operation {
88+
final class HubDispatchOperation: Operation, @unchecked Sendable {
8989

9090
private static let thresholdForConcurrentPerform = 500
9191

AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Amplify
99
import AWSPluginsCore
1010
import Foundation
1111

12-
final public class AWSGraphQLOperation<R: Decodable>: GraphQLOperation<R> {
12+
final public class AWSGraphQLOperation<R: Decodable>: GraphQLOperation<R>, @unchecked Sendable {
1313

1414
let session: URLSessionBehavior
1515
let mapper: OperationTaskMapper

AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public class AWSGraphQLSubscriptionTaskRunner<R: Decodable>: InternalTaskRunner,
183183
}
184184

185185
// Class is still necessary. See https://github.com/aws-amplify/amplify-swift/issues/2252
186-
final public class AWSGraphQLSubscriptionOperation<R: Decodable>: GraphQLSubscriptionOperation<R> {
186+
final public class AWSGraphQLSubscriptionOperation<R: Decodable>: GraphQLSubscriptionOperation<R>, @unchecked Sendable {
187187

188188
let pluginConfig: AWSAPICategoryPluginConfiguration
189189
let appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol

AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Foundation
2323
/// **Note**: The class inheritance to `HTTPURLResponse` is to provide above mechanism, and actual
2424
/// implementation acts as a facade that stores an instance of `HTTPURLResponse` that delegates overidden methods to
2525
/// this stored property.
26-
public class AWSHTTPURLResponse: HTTPURLResponse {
26+
public class AWSHTTPURLResponse: HTTPURLResponse, @unchecked Sendable {
2727

2828
/// The body of the response, if available
2929
public let body: Data?

0 commit comments

Comments
 (0)