I have a model named Item and Tag. Item has multi tags. I need to filter array of items by another array of tags. Tags to be used for filter are given by array of string.
I googled but couldn't find answer to solve my situation.
struct Tag {
let id: Int
let name: String
}
struct Item {
let id: Int
let tags: [Tag]
}
func filter(items: [Item], contains tags: [String]) -> [Item] {
// Need to implement filter
}