title: Swift: Filter a NSSet for class types
body: <p>In objective-C I had this function to filter an <code>NSSet</code> for an array of class types:</p>
  
  <pre><code>+ (NSSet *)filterSubjectsSet:(NSSet *)subjects forClasses:(NSArray *)classes
  {
      NSSet *filterSet = [subjects objectsPassingTest:^(id obj, BOOL *stop) {
          return [classes containsObject:[obj class]];
      }];
      return filterSet;
  }
  </code></pre>
  
  <p>I am struggling to find a neat way to implement the same function in Swift. This is what I had hoped would work:</p>
  
  <pre><code>class func filterSubjectsSet(subjects: NSSet, forClasses classes: [AnyClass]) -&gt; NSSet {
  
      let set = subjects.objectsPassingTest() {
          find(classes, object_getClass($0)) != nil
      }        
      return set
  }
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>Type 'AnyObject.Type' does not conform to protocol 'Equatable'
  </code></pre>
  
  <p>How should I be doing this?</p>