使用元组交换两个数据

func swapTwoInts( a: inout Int, b: inout Int) {
    (a, b) = (b, a)
}

var x = 1
var y = 2
swapTwoInts(a: &x, b: &y)
x    // 2
y    // 1
原文地址:https://www.cnblogs.com/muzijie/p/6541792.html