<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Dictionary/Keys-swift.struct/Iterator",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SD4KeysV8IteratorV"
  },
  "title" : "Dictionary.Keys.Iterator"
}
-->

# Dictionary.Keys.Iterator

A type that provides the collection’s iteration interface and
encapsulates its iteration state.

```
@frozen struct Iterator
```

## Overview

By default, a collection conforms to the `Sequence` protocol by
supplying `IndexingIterator` as its associated `Iterator`
type.

## Topics

### Instance Methods

[`func next() -> Key?`](/documentation/Swift/Dictionary/Keys-swift.struct/Iterator/next())

Advances to the next element and returns it, or `nil` if no next element
exists.

### Type Aliases

[`typealias Element`](/documentation/Swift/Dictionary/Keys-swift.struct/Iterator/Element)

The type of element traversed by the iterator.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`IteratorProtocol`](/documentation/Swift/IteratorProtocol)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)