My class declares an array
var laps: (start: NSDate!, end: NSDate!)[] = []
When a tuple is added to this array I\'d like to be able to do s
There's a bug in using .append
with arrays of tuples. You can use the +=
operator instead:
laps += lap
I've tried to following, and it looked correct syntactically:
typealias MyTuple = (start: NSDate!, end: NSDate?)
then in the method, I did:
var laps: Array<MyTuple> = Array()
laps.append((NSDate.date(), nil))