Instance Method (Default implementation)swift 6.0.1Swift

swapAt(_:_:)

Exchanges the values at the specified indices of the collection.

mutating func swapAt(_ i: Self.Index, _ j: Self.Index)

Parameters

i

The index of the first value to swap.

j

The index of the second value to swap.

Both parameters must be valid indices of the collection that are not equal to endIndex. Calling swapAt(_:_:) with the same index as both i and j has no effect.