filter an array in Swift

PHOTO EMBED

Thu Jan 13 2022 10:58:19 GMT+0000 (UTC)

Saved by @hasnat #swift #filter #array #ios

To Filter Model Array:

var filteredItems = unfilteredItems.filter { $0.cat == "garden" }

To Filter an Array:

let result = arr.filter {$0.contains("ali")}
content_copyCOPY

https://stackoverflow.com/questions/48467867/adding-a-filter-to-an-array-in-swift-4