---
title: allKeys
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsdictionary/allkeys
---

# allKeys

A new array containing the dictionary’s keys, or an empty array if the dictionary has no entries.

## Declaration

```swift
var allKeys: [Any] { get }
```

## Discussion

Discussion The order of the elements in the array is not defined.

## See Also

### Accessing Keys and Values

- [allKeys(for:)](foundation/nsdictionary/allkeys(for:).md)
- [allValues](foundation/nsdictionary/allvalues.md)
- [value(forKey:)](foundation/nsdictionary/value(forkey:).md)
- [objects(forKeys:notFoundMarker:)](foundation/nsdictionary/objects(forkeys:notfoundmarker:).md)
- [object(forKey:)](foundation/nsdictionary/object(forkey:).md)
- [subscript(_:)](foundation/nsdictionary/subscript(_:)-52n56.md)
- [subscript(_:)](foundation/nsdictionary/subscript(_:)-1bt1b.md)
