I have a list of entries, that have an id, and I want to filter them down to ones that have an entry.id matching one of the ids in selectedIDs. Is there a way to do this with filter or do I have to use a for loop?
struct Entry {
let id: String
}
var allEntries = [Entry]()
var selectedIDs = [String]
e.g.
allEntries = [Entry(id: "1"), Entry(id:"2"), Entry(id:"3"), Entry(id:"4")]
selectedIDs = ["1", "3"]
// return selectedEntries
var selectedEntries = [Entry(id: "1"), Entry(id: "3")]