swap(_:_:)
Exchanges the values of the two arguments.
func swap<T>(_ a: inout T, _ b: inout T)
Parameters
- a
The first value to swap.
- b
The second value to swap.
The two arguments must not alias each other. To swap two elements of a mutable collection, use the swapAt(_:_:)
method of that collection instead of this function.