---
title: "sortedCookies(using:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/httpcookiestorage/sortedcookies(using:)"
---

# sortedCookies(using:)

Returns all of the cookie storage’s cookies, sorted according to a given set of sort descriptors.

## Declaration

```swift
func sortedCookies(using sortOrder: [NSSortDescriptor]) -> [HTTPCookie]
```

## Parameters

- `sortOrder`: The sort descriptors to use for sorting, as an array of doc://com.apple.foundation/documentation/Foundation/NSSortDescriptor objects.

## Return Value

Return Value The cookie storage’s cookies, sorted according to sortOrder, as an array of HTTPCookie objects.

## See Also

### Retrieving cookies

- [cookies](foundation/httpcookiestorage/cookies.md)
- [getCookiesFor(_:completionHandler:)](foundation/httpcookiestorage/getcookiesfor(_:completionhandler:).md)
- [cookies(for:)](foundation/httpcookiestorage/cookies(for:).md)
