Instance Method


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


func cachedResponse(for request: URLRequest) -> CachedURLResponse?



The URL request whose cached response is desired.

Return Value

The cached URL response for request, or nil if no response has been cached.


If you override this method, you should also override getCachedResponse(for:completionHandler:).

See Also

Getting and Storing Cached Objects

func storeCachedResponse(CachedURLResponse, for: URLRequest)

Stores a cached URL response for a specified request.

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

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

func storeCachedResponse(CachedURLResponse, for: URLSessionDataTask)

Stores a cached URL response for a specified data task.