Why does the reverse() function in the Swift standard library return ReverseRandomAccessCollection?
It is an performance optimization for both time and memory. The ReverseRandomAccessCollection presents the elements of the original array in reverse order, without the need to create a new array and copying all elements (as long as the original array is not mutated). You can access the reversed elements with subscripts: let el0 = arr[arr.startIndex] … Read more