I am curious how to do a for loop with a tuple in swift.
I know that to access each member you can use dot notation using the index number
var tuple
You can using reflection Swift 5
Try this in a Playground:
let tuple = (1, 2, "3") let tupleMirror = Mirror(reflecting: tuple) let tupleElements = tupleMirror.children.map({ $0.value }) tupleElements
Output: