Instance Method

getCachedResponse(for:completionHandler:)

Gets the cached URL response for a data task, passing it to the provided completion handler.

Declaration

func getCachedResponse(for dataTask: URLSessionDataTask, completionHandler: @escaping (CachedURLResponse?) -> Void)

Parameters

dataTask

The data task whose cached URL response is desired.

completionHandler

A completion handler that receives the cached URL response for the data task's request, or nil if no response is found in the cache.

See Also

Getting and Storing Cached Objects

func cachedResponse(for: URLRequest) -> CachedURLResponse?

Returns the cached URL response in the cache for the specified URL request.

func storeCachedResponse(CachedURLResponse, for: URLRequest)

Stores a cached URL response for a specified request.

func storeCachedResponse(CachedURLResponse, for: URLSessionDataTask)

Stores a cached URL response for a specified data task.