Initializer

init(request:cachedResponse:client:)

Creates a URL protocol instance to handle the request.

Declaration

init(request: URLRequest, cachedResponse: CachedURLResponse?, client: URLProtocolClient?)

Parameters

request

The URL request for the URL protocol object. This request is retained.

cachedResponse

A cached response for the request; it may be nil if there is no existing cached response for the request.

client

An object that provides an implementation of the URLProtocolClient protocol that this instance uses to communicate with the URL Loading System. This client object is retained.

Return Value

The initialized protocol object.

Discussion

Subclasses should override this method to do any custom initialization. Don’t call this method explicitly. When you register your custom protocol class, the system will initialize instances of your protocol as needed.

This is the designated initializer for URLProtocol.

See Also

Creating Protocol Objects