Type Method


Returns a canonical version of the specified request.


class func canonicalRequest(for request: URLRequest) -> URLRequest



The request whose canonical version is desired.

Return Value

The canonical form of request.


It is up to each concrete protocol implementation to define what “canonical” means. A protocol should guarantee that the same input request always yields the same canonical form.

Special consideration should be given when implementing this method, because the canonical form of a request is used to lookup objects in the URL cache, a process which performs equality checks between URLRequest instances.

This is an abstract method and subclasses must provide an implementation.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software