Returns a subsequence by skipping elements while predicate returns true and returning the remaining elements.
SDK
- Xcode 11.0+
Framework
- Swift Standard Library
Declaration
func drop(while predicate: (Collection Difference<ChangeElement>.Change) throws -> Bool) rethrows -> Slice<Collection Difference<ChangeElement>>
Parameters
predicateA closure that takes an element of the sequence as its argument and returns
trueif the element should be skipped orfalseif it should be included. Once the predicate returnsfalseit will not be called again.
Discussion
Complexity: O(n), where n is the length of the collection.