Swift Tuple index using a variable as the index? Anyone know if it is possible to use a variable as the index for a Swift tuple index. I wish to select and item from a tuple usi
As long as tuple index is just default name, and you can provide your own names
let testTuple = (first: 1, second: 2.0) let first: Int = testTuple.first let second: Double = testTuple.second
you can not use variable as index. Pretty close question "can I use KVC for tuple?", and answer - you can't