1
我需要找到所有對象,其中包含第一個和第二個數組。我有這樣的代碼,它工作正常:我該如何簡化這個數組過濾器表達式?
let items = catalog.items.filter({ (item) -> Bool in
orderItems.contains { $0.id == item.id }
})
但我想,以減少它看起來像:
catalog.items.filter{items.contains{ $0.id == first.id }}
其中first.id - 是從元素catalog.items。我怎樣才能做到這一點))
非常感謝你) – Banck