Contents

getAllCookies(_:)

Fetches all stored cookies asynchronously and delivers them to the specified completion handler.

Declaration

func getAllCookies(_ completionHandler: @escaping @MainActor @Sendable ([HTTPCookie]) -> Void)
func allCookies() async -> [HTTPCookie]

Parameters

  • completionHandler:

    A completion handler block to execute asynchronously with the results. This block has no return value and takes the following parameter:

    cookieArray

    An array of Httpcookie objects. If the store contains no cookies, this parameter contains an empty array.

Discussion

Use this method to get the set of cookies currently associated with your web view. Iterate over the contents of the provided array to retrieve the specific cookie you need for your code.

See Also

Managing cookies