DefaultInterceptorProvider
CLASS
DefaultInterceptorProvider
Swift
1open class DefaultInterceptorProvider: InterceptorProviderThe default interceptor provider for typescript-generated code
Methods
init(client:shouldInvalidateClientOnDeinit:store:)
Swift
1public init(client: URLSessionClient = URLSessionClient(),
2 shouldInvalidateClientOnDeinit: Bool = true,
3 store: ApolloStore)Designated initializer
Parameters:
client: The
URLSessionClientto use. Defaults to the default setup.shouldInvalidateClientOnDeinit: If the passed-in client should be invalidated when this interceptor provider is deinitialized. If you are recreating the
URLSessionClientevery time you create a new provider, you should do this to prevent memory leaks. Defaults to true, since by default we provide aURLSessionClientto new instances.store: The
ApolloStoreto use when reading from or writing to the cache. Make sure you pass the same store to theApolloClientinstance you're planning to use.
Parameters
| Name | Description |
|---|---|
| client | The URLSessionClient to use. Defaults to the default setup. |
| shouldInvalidateClientOnDeinit | If the passed-in client should be invalidated when this interceptor provider is deinitialized. If you are recreating the URLSessionClient every time you create a new provider, you should do this to prevent memory leaks. Defaults to true, since by default we provide a URLSessionClient to new instances. |
| store | The ApolloStore to use when reading from or writing to the cache. Make sure you pass the same store to the ApolloClient instance you’re planning to use. |
deinit
Swift
1deinitinterceptors(for:)
Swift
1open func interceptors<Operation: GraphQLOperation>(for operation: Operation) -> [ApolloInterceptor]Parameters
| Name | Description |
|---|---|
| operation | The operation to provide interceptors for |
additionalErrorInterceptor(for:)
Swift
1open func additionalErrorInterceptor<Operation: GraphQLOperation>(for operation: Operation) -> ApolloErrorInterceptor?Parameters
| Name | Description |
|---|---|
| operation | The operation to provide an additional error interceptor for |