From 6fcf8203c77f5fed5faf4228c126c07425b5f923 Mon Sep 17 00:00:00 2001 From: Joshua Kaplan Date: Fri, 26 Mar 2021 11:33:51 +0900 Subject: [PATCH] Replace `class` constraint with `AnyObject` ref: https://github.com/apple/swift-evolution/blob/master/proposals/0156-subclass-existentials.md#class-and-anyobject --- Sources/Apollo/ApolloClientProtocol.swift | 2 +- Sources/Apollo/ApolloInterceptor.swift | 2 +- Sources/Apollo/ApolloStore.swift | 2 +- Sources/Apollo/Cancellable.swift | 2 +- Sources/Apollo/GraphQLOperation.swift | 2 +- Sources/Apollo/GraphQLResultAccumulator.swift | 2 +- Sources/Apollo/NetworkTransport.swift | 2 +- Sources/ApolloTestSupport/TestCacheProvider.swift | 2 +- Sources/ApolloWebSocket/WebSocketTransport.swift | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/Apollo/ApolloClientProtocol.swift b/Sources/Apollo/ApolloClientProtocol.swift index 00b2dec1d8..706c4b5b4e 100644 --- a/Sources/Apollo/ApolloClientProtocol.swift +++ b/Sources/Apollo/ApolloClientProtocol.swift @@ -1,7 +1,7 @@ import Foundation /// The `ApolloClientProtocol` provides the core API for Apollo. This API provides methods to fetch and watch queries, and to perform mutations. -public protocol ApolloClientProtocol: class { +public protocol ApolloClientProtocol: AnyObject { /// A store used as a local cache. var store: ApolloStore { get } diff --git a/Sources/Apollo/ApolloInterceptor.swift b/Sources/Apollo/ApolloInterceptor.swift index 00819d3fec..0a55999edf 100644 --- a/Sources/Apollo/ApolloInterceptor.swift +++ b/Sources/Apollo/ApolloInterceptor.swift @@ -1,5 +1,5 @@ /// A protocol to set up a chainable unit of networking work. -public protocol ApolloInterceptor: class { +public protocol ApolloInterceptor: AnyObject { /// Called when this interceptor should do its work. /// diff --git a/Sources/Apollo/ApolloStore.swift b/Sources/Apollo/ApolloStore.swift index 2fe9dd2f95..b7a64afe53 100644 --- a/Sources/Apollo/ApolloStore.swift +++ b/Sources/Apollo/ApolloStore.swift @@ -15,7 +15,7 @@ func rootCacheKey(for operation: Operation) -> Stri } } -protocol ApolloStoreSubscriber: class { +protocol ApolloStoreSubscriber: AnyObject { /// A callback that can be received by subscribers when keys are changed within the database /// diff --git a/Sources/Apollo/Cancellable.swift b/Sources/Apollo/Cancellable.swift index f48dc21933..73b502b7d7 100644 --- a/Sources/Apollo/Cancellable.swift +++ b/Sources/Apollo/Cancellable.swift @@ -1,7 +1,7 @@ import Foundation /// An object that can be used to cancel an in progress action. -public protocol Cancellable: class { +public protocol Cancellable: AnyObject { /// Cancel an in progress action. func cancel() } diff --git a/Sources/Apollo/GraphQLOperation.swift b/Sources/Apollo/GraphQLOperation.swift index bff34a1fd7..6be6b6a1c0 100644 --- a/Sources/Apollo/GraphQLOperation.swift +++ b/Sources/Apollo/GraphQLOperation.swift @@ -4,7 +4,7 @@ public enum GraphQLOperationType { case subscription } -public protocol GraphQLOperation: class { +public protocol GraphQLOperation: AnyObject { var operationType: GraphQLOperationType { get } var operationDefinition: String { get } diff --git a/Sources/Apollo/GraphQLResultAccumulator.swift b/Sources/Apollo/GraphQLResultAccumulator.swift index 521cbe53d9..361f41907d 100644 --- a/Sources/Apollo/GraphQLResultAccumulator.swift +++ b/Sources/Apollo/GraphQLResultAccumulator.swift @@ -1,4 +1,4 @@ -protocol GraphQLResultAccumulator: class { +protocol GraphQLResultAccumulator: AnyObject { associatedtype PartialResult associatedtype FieldEntry associatedtype ObjectResult diff --git a/Sources/Apollo/NetworkTransport.swift b/Sources/Apollo/NetworkTransport.swift index f66073be8e..a7aadfed62 100644 --- a/Sources/Apollo/NetworkTransport.swift +++ b/Sources/Apollo/NetworkTransport.swift @@ -1,7 +1,7 @@ import Foundation /// A network transport is responsible for sending GraphQL operations to a server. -public protocol NetworkTransport: class { +public protocol NetworkTransport: AnyObject { /// Send a GraphQL operation to a server and return a response. /// diff --git a/Sources/ApolloTestSupport/TestCacheProvider.swift b/Sources/ApolloTestSupport/TestCacheProvider.swift index 3875416d1c..50800f646f 100644 --- a/Sources/ApolloTestSupport/TestCacheProvider.swift +++ b/Sources/ApolloTestSupport/TestCacheProvider.swift @@ -4,7 +4,7 @@ import XCTest public typealias TearDownHandler = () throws -> () public typealias TestDependency = (Resource, TearDownHandler?) -public protocol TestCacheProvider: class { +public protocol TestCacheProvider: AnyObject { static func makeNormalizedCache(_ completionHandler: (Result, Error>) -> ()) } diff --git a/Sources/ApolloWebSocket/WebSocketTransport.swift b/Sources/ApolloWebSocket/WebSocketTransport.swift index 4755d0b02b..cb2b499467 100644 --- a/Sources/ApolloWebSocket/WebSocketTransport.swift +++ b/Sources/ApolloWebSocket/WebSocketTransport.swift @@ -7,7 +7,7 @@ import Foundation // MARK: - Transport Delegate -public protocol WebSocketTransportDelegate: class { +public protocol WebSocketTransportDelegate: AnyObject { func webSocketTransportDidConnect(_ webSocketTransport: WebSocketTransport) func webSocketTransportDidReconnect(_ webSocketTransport: WebSocketTransport) func webSocketTransport(_ webSocketTransport: WebSocketTransport, didDisconnectWithError error:Error?)