Returns a subsequence from the specified position to the end of the collection.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Parameters
start
The index at which to start the resulting subsequence.
start
must be a valid index of the collection.
Return Value
A subsequence starting at the start
position.
Discussion
The following example searches for the index of the number 40
in an array of integers, and then prints the suffix of the array starting at that index:
Passing the collection’s end
as the start
parameter results in an empty subsequence.
Using the suffix(from:)
method is equivalent to using a partial range from the index as the collection’s subscript. The subscript notation is preferred over suffix(from:)
.
Complexity: O(1)