- Mastering macOS Programming
- Stuart Grimshaw
- 43字
- 2021-07-02 22:54:40
Accessing all keys or values
If necessary, we can access all of a dictionary's keys or values, as follows:
var dict: Dictionary<String, String> = ["one": "drum",
"two": "shoe",
"three": "knee"]
for key in dict.keys { print(key) }
for value in dict.values { print(value) }