Returns a sequence, up to the specified maximum length, containing the initial elements of the sequence.
- Xcode 10.2+
- Swift Standard Library
The maximum number of elements to return. The value of
maxmust be greater than or equal to zero.
A sequence starting at the beginning of this sequence with at most
If the maximum length exceeds the number of elements in the sequence, the result contains all the elements in the sequence.