---
title: "getCookies(for:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkhttpcookiestore/getcookies(for:completionhandler:)"
---

# getCookies(for:completionHandler:)

## Declaration

```swift
func getCookies(for url: URL, completionHandler: @escaping @MainActor @Sendable ([HTTPCookie]) -> Void)
```

```swift
func getCookies(for url: URL) async -> [HTTPCookie]
```

## Parameters

- `url`: The URL to fetch the matching cookies for.
- `completionHandler`: A block to invoke with the fetched cookies.

## Discussion

Discussion Fetches stored cookies that match the passed in URL.
