Answers for "convert array of objects to array of dictionary swift"

0

swift map array to dictionary

let myDictionary = myArray.reduce([Int: String]()) { (dict, person) -> [Int: String] in
    var dict = dict
    dict[person.position] = person.name
    return dict
}

//[2: "b", 3: "c", 1: "a"]
Posted by: Guest on October-29-2020

Code answers related to "convert array of objects to array of dictionary swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language