Multidimensional arrays of different types in Swift
I can easily write a multidimensional array in Swift when all dimensions are of the same type, e.g .:
var totalTime : [[Int]]
How would I get the first dimension as String and the second Int dimension?
+3
Øyvind Vik
source
to share
1 answer
I would recommend using an array of tuples instead. What you want can be accomplished using an array of type Any, but that's not a good idea.
Instead, your array should be [[(String, Int)]]. It will also be more compact than what you want to do.
+6
erdekhayser
source
to share