title: How to use the "ALL" aggregate operation in a NSPredicate to filter a CoreData-based collection
body: <p>Based on the data model below</p>
  
  <p><img src="https://i.stack.imgur.com/Zjr8b.png" alt="dataModel"></p>
  
  <p>And based on user input I create a NSSet of managedObjects of entity Tag called <em>selectedTags</em>.</p>
  
  <hr>
  
  <h2>My problem:</h2>
  
  <pre><code>[NSPredicate predicateWithFormat:@"ANY entryTags IN %@", selectedTags];
  </code></pre>
  
  <p>... this will return <em>any</em> Entry with at least one entryTag that is in the selectedTags set.</p>
  
  <p>I want something along the lines of:</p>
  
  <pre><code>[NSPredicate predicateWithFormat:@"ALL entryTags IN %@", selectedTags];
  </code></pre>
  
  <p>... notice the only change is the "ANY" to "ALL". This illustrates what I want, but does not work. </p>
  
  <p>To formulate the outcome I expect:</p>
  
  <p>I'm looking for a solution that will return only Entries who's entryTags are all in the selectedTags list (but at the same time, if possible, not necessarily the other way around).</p>
  
  <p>To further illustrate:</p>
  
  <p>(tag)Mom<br>
  (tag)Dad<br>
  (tag)Gifts  </p>
  
  <p>(entry)she is a she.....(tag)mom<br>
  (entry)he is a he........(tag)dad<br>
  (entry)gifts for mom...(tags:)mom, gifts<br>
  (entry)gifts for dad.....(tags:)dad, gifts</p>
  
  <p>If selectedTags contains "mom" and "gifts", then the entry "gifts for dad" will show up, since it has the tag "gifts". I'd rather have it not show :)</p>