swift find object in array by property code example
Example: find object in array by property swift
if array.contains(where: {$0.name == "foo"}) {
// it exists, do something
} else {
//item could not be found
}
if array.contains(where: {$0.name == "foo"}) {
// it exists, do something
} else {
//item could not be found
}