Contents

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  @Sendable (CachedURLResponse?) -> Void)
func cachedResponse(for dataTask: URLSessionDataTask) async -> CachedURLResponse?

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