I can easily write a multi-dimensional array in Swift when all the dimensions are of the same type, for example:
var totalTime : [[Int]]
How would I get the first dimension to be String and the second dimension Int?
I can easily write a multi-dimensional array in Swift when all the dimensions are of the same type, for example:
var totalTime : [[Int]]
How would I get the first dimension to be String and the second dimension Int?
I would recommend using an array of tuples instead. What you want could be accomplished using an array of type Any, but it is not a good idea.
Instead, your array should be [[(String, Int)]]. This would also be more compact than what you want to do.
var myArray: [[(String, Int)]] = []
var arrayTest: [[(String, Int)]] = []; arrayTest.append([("Hello", 2)]); println(arrayTest);= []. This answers my questions! Thank you!