swift find element with predicate code example
Example: swift first where
if let firstMatch = yourArray.first(where: {$0.id == lookupId}) {
print("found it: \(firstMatch)")
} else {
print("nothing found :(")
}
if let firstMatch = yourArray.first(where: {$0.id == lookupId}) {
print("found it: \(firstMatch)")
} else {
print("nothing found :(")
}