Type Method


Converts an array of cookies to a dictionary of header fields.


class func requestHeaderFields(with cookies: [HTTPCookie]) -> [String : String]



The cookies from which the header fields are created.

Return Value

The dictionary of header fields created from the provided cookies.


To send these headers as part of a URL request to a remote server, create an NSMutableURLRequest object, then call the allHTTPHeaderFields or setValue(_:forHTTPHeaderField:) method to set the provided headers for the request. Finally, initialize and start an URLSessionTask instance based on that request object.

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