Type Method


Creates an array HTTP cookies corresponding to the provided response header fields for the provided URL.


class func cookies(withResponseHeaderFields headerFields: [String : String], for URL: URL) -> [HTTPCookie]



The header fields used to create the HTTPCookie objects.


The URL associated with the created cookies.

Return Value

The array of created cookies.


This method ignores irrelevant header fields in headerFields, allowing dictionaries to contain additional data.

If headerFields doesn’t specify a domain for a given cookie, the cookie is created with a default domain value of URL.

If headerFields doesn’t specify a path for a given cookie, the cookie is created with a default path value of "/".

See Also

Creating Cookies

init?(properties: [HTTPCookiePropertyKey : Any])

Creates an HTTP cookie instance with the given cookie properties.

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