Check out example codes for "swift first where". It will help you in understanding the concepts better.

Code Example 1

if let firstMatch = yourArray.first(where: {$0.id == lookupId}) {
  print("found it: \(firstMatch)")
} else {
  print("nothing found :(")
}

Learn ReactJs, React Native from akashmittal.com