---
title: "toDictionary(with:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/array/todictionary(with:)"
---

# toDictionary(with:)

## Declaration

```swift
func toDictionary<Key>(with selectKey: (Element) -> Key) -> [Key : Element] where Key : Hashable
```
