cookies(for:)
Returns all the cookie storage’s cookies that are sent to a specified URL.
Declaration
func cookies(for URL: URL) -> [HTTPCookie]?Parameters
- URL:
The URL to filter on.
Return Value
An array of cookies whose URL matches the provided URL.
Discussion
You can use the requestHeaderFields(with:) method of HTTPCookie to turn the array returned by this method into a set of header fields to add to a URLRequest object (or NSMutableURLRequest in Objective-C).
If you override this method, also override getCookiesFor(_:completionHandler:).