Check out example codes for "find object in array by property swift". It will help you in understanding the concepts better.
Code Example 1
if array.contains(where: {$0.name == "foo"}) {
// it exists, do something
} else {
//item could not be found
}
Learn ReactJs, React Native from akashmittal.com