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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)