Type Method

cookies(withResponseHeaderFields:for:)

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

Declaration

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

Parameters

headerFields

The header fields used to create the HTTPCookie objects.

URL

The URL associated with the created cookies.

Return Value

The array of created cookies.

Discussion

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.