Does Swift have something like “ref” keyword that forces parameter to be passed by reference?
Use the inout qualifier for a function parameter. func swapTwoInts(a: inout Int, b: inout Int) { let temporaryA = a a = b b = temporaryA } swapTwoInts(&someInt, &anotherInt) See Function Parameters and Return Values in the docs.