Instance Method

reversed()

Returns an array containing the elements of this sequence in reverse order.

Declaration

func reversed() -> [Self.Element]

Return Value

An array containing the elements of this sequence in reverse order.

Discussion

The sequence must be finite.

Complexity: O(n), where n is the length of the sequence.

See Also

Sorting Elements

func sorted() -> [Self.Element]

Returns the elements of the sequence, sorted.

func sorted(by: (Self.Element, Self.Element) -> Bool) -> [Self.Element]

Returns the elements of the sequence, sorted using the given predicate as the comparison between elements.