Answers for "dictionary convert an element to array swift"

0

convert dictionary to array swift

let dic = ["1":"a", "2":"b", "3":"c"]

let arrayOfKeys = Array(dic.keys.map{ $0 })
print(arrayOfKeys) // [1, 2, 3]
let arrayOfValues = Array(dic.values.map{ $0 })
print(arrayOfValues) // [a, b, c]
Posted by: Guest on March-25-2020

Code answers related to "dictionary convert an element to array swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language