Removes all the elements that satisfy the given predicate.
- Xcode 10.0+
- 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 removed from the collection.
Use this method to remove every element in a collection that meets particular criteria. The order of the remaining elements is preserved. This example removes all the odd values from an array of numbers:
Complexity: O(n), where n is the length of the collection.