I want to convert my dictionary to an array, by showing each [String : Int]
of the dictionary as a string in the array.
For example:
var myDict: [String : Int] = ["attack" : 1, "defend" : 5, "block" : 12]
I'm aware of myDict.keys.array
and myDict.values.array
, but I want them to show up in an array together. Here's what I mean:
var myDictConvertedToArray = ["attack 1", "defend 5", "block 12"]