Instance MethodSwift
reverse()
Reverses the elements of the collection in place.
Available because
Self
conforms toMutableCollection
.Available when
Self
conforms toBidirectionalCollection
mutating func reverse()
Overview
The following example reverses the elements of an array of characters:
var characters: [Character] = ["C", "a", "f", "é"]
characters.reverse()
print(characters)
// Prints "["é", "f", "a", "C"]"