CacheReadInterceptor
STRUCT
CacheReadInterceptor
Swift
1public struct CacheReadInterceptor: ApolloInterceptorAn interceptor that reads data from the cache for queries, following the HTTPRequest's cachePolicy.
Methods
init(store:)
Swift
1public init(store: ApolloStore)Designated initializer
Parameter store: The store to use when reading from the cache.
Parameters
| Name | Description |
|---|---|
| store | The store to use when reading from the cache. |
interceptAsync(chain:request:response:completion:)
Swift
1public func interceptAsync<Operation: GraphQLOperation>(
2 chain: RequestChain,
3 request: HTTPRequest<Operation>,
4 response: HTTPResponse<Operation>?,
5 completion: @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void)Parameters
| Name | Description |
|---|---|
| chain | The chain the interceptor is a part of. |
| request | The request, as far as it has been constructed |
| response | [optional] The response, if received |
| completion | The completion block to fire when data needs to be returned to the UI. |