Creates a view into the given collection that allows access to elements within the specified range.
- Xcode 7.0+
- Swift Standard Library
The collection to create a view into.
The range of indices to allow access to in the new slice.
It is unusual to need to call this method directly. Instead, create a slice of a collection by using the collection’s range-based subscript or by using methods that return a subsequence.
In this example, the expression
single is equivalent to calling this initializer with
single and a range covering the last five items of