---
title: makeIterator()
framework: swift
role: symbol
role_heading: Instance Method
path: swift/dictionary/makeiterator()
---

# makeIterator()

Returns an iterator over the dictionary’s key-value pairs.

## Declaration

```swift
func makeIterator() -> Dictionary<Key, Value>.Iterator
```

## Return Value

Return Value An iterator over the dictionary with elements of type (key: Key, value: Value).

## Discussion

Discussion Iterating over a dictionary yields the key-value pairs as two-element tuples. You can decompose the tuple in a for-in loop, which calls makeIterator() behind the scenes, or when calling the iterator’s next() method directly. let hues = ["Heliotrope": 296, "Coral": 16, "Aquamarine": 156] for (name, hueValue) in hues {     print("The hue of \(name) is \(hueValue).") } // Prints "The hue of Heliotrope is 296." // Prints "The hue of Coral is 16." // Prints "The hue of Aquamarine is 156."

## See Also

### Iterating over Keys and Values

- [forEach(_:)](swift/dictionary/foreach(_:).md)
- [enumerated()](swift/dictionary/enumerated().md)
- [lazy](swift/dictionary/lazy.md)
- [underestimatedCount](swift/dictionary/underestimatedcount.md)
