Accesses a contiguous subrange of the buffer’s elements.
- Xcode 10.0+
- Swift Standard Library
A range of the buffer’s indices. The bounds of the range must be valid indices of the buffer.
The accessed slice uses the same indices for the same elements as the original buffer uses. Always use the slice’s
start property instead of assuming that its indices start at a particular value.
This example demonstrates getting a slice from a buffer of strings, finding the index of one of the strings in the slice, and then using that index in the original buffer.