📜  通过属性 swift 代码示例在数组中查找对象

📅  最后修改于: 2022-03-11 15:01:00.759000             🧑  作者: Mango

代码示例1
if array.contains(where: {$0.name == "foo"}) {
   // it exists, do something
} else {
   //item could not be found
}