Reputation: 4033
I have an array carsArray
of structs - each struct has a name. A name might be used several times inside of this array.
Let's say I have a car called "Audi" - how can I filter the given array of structs and delete every entry with the name "Audi" ?
Upvotes: 0
Views: 41
Reputation: 100503
Model
struct Car {
let name:String
}
Filter & Remove all items with a specific criteria
var arr = [Car]()
// fill the array here
arr.removeAll(where:{ $0.name == "Audi" })
Upvotes: 1