Appending tuples to an array of tuples

后端 未结 2 718
轮回少年
轮回少年 2020-12-20 00:12

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

2条回答
  •  不知归路
    2020-12-20 01:16

    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 = Array()
    laps.append((NSDate.date(), nil))
    

提交回复
热议问题