How to remove more than one item at once from Array with matching condition in Swift
byIn Swift most sequence collections provides removeAll(where:) - an efficient way to remove at once multiple items matching the coditional logic from collection.
removeAll(where:)
Removes all the elements that satisfy the given predicate.
myArray.removeAll { customObject in
return customObject.id == "query"
}
You might also like: How to limit the number of characters in a UITextField or UITextView