Mastering macOS Programming
上QQ阅读APP看书,第一时间看更新

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) }