Swift:你如何声明一个名为元组的空数组?

时间:2015-05-01 08:29:33

标签: ios swift

var test = [(face: SKNode, body: SKNode)]()

不起作用。如何声明一个名为元组的空数组?

2 个答案:

答案 0 :(得分:5)

您可以随时使用typealias

typealias MyTupleThing = (face: SKNode, body: SKNode)
var test = [MyTupleThing]()

答案 1 :(得分:3)

尝试:

var test: [(face: SKNode, body: SKNode)] = []

var test = Array<(face: SKNode, body: SKNode)>()