Reputation: 65
I have array [[one, two, three, four]]
and I want to convert array in [["one", "two"," three", "four"]]
without using a loop in Swift 3.
I tried
let myArray = array.map { String($0) }
But this is returning ["[one, two, three, four]"]
.
Upvotes: 2
Views: 1207
Reputation: 41226
In your case, you actually have two arrays. You have an array OF arrays of whatever one, etc. are.
Try:
let result = array.map { $0.map { String($0) } }
Upvotes: 3