title: Swift 4 - Filtering Array with Array
body: <p>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?</p>
  
  <pre><code>struct Entry {
      let id: String
  }
  var allEntries = [Entry]()
  var selectedIDs = [String]
  </code></pre>
  
  <p>e.g.</p>
  
  <pre><code>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")]
  </code></pre>