Returns a sequence by skipping the initial, consecutive elements that satisfy the given predicate.
- Xcode 10.2+
- Swift Standard Library
A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element should be included in the result.
A sequence starting after the initial, consecutive elements that satisfy
The following example uses the
drop(while:) method to skip over the positive numbers at the beginning of the
numbers array. The result begins with the first element of
numbers that does not satisfy
predicate matches every element in the sequence, the result is an empty sequence.
Complexity: O(k), where k is the number of elements to drop from the beginning of the sequence.