title: Filter Array of [AnyObject] in Swift
body: <p>I have an array of <code>AnyObject</code> objects in Swift. Each object has attributes of a restaurant, such as name, type, loc, etc. How can I filter the array if I want to keep all objects in the array that contain type: "Sushi".</p>
  
  <p>Sample array of <code>[AnyObject]</code> with 2 objects. The filter should keep the first object (type: sushi):</p>
  
  <pre><code>[&lt;Restaurant: 0x7ff302c8a4e0, objectId: LA74J92QDA, localId: (null)&gt; {
      City = "New York";
      Country = "United States";
      Name = Sumo Japan;
      Type = Sushi, Japanese, Asian;
  }, &lt;Restaurant: 0x7ff302daa790, objectId: 0aKFrpKN46, localId: (null)&gt; {
      City = "New York";
      Country = "United States";
      Name = Little Italy;
      Type = Italian, Pizza;
  }]
  </code></pre>
  
  <p>Current Code (but I'm not sure if the filter can search through an array of <code>[AnyObject]</code>) :</p>
  
  <pre><code>var query = PFQuery(className:"Restaurant")
  query.whereKey("RestaurantLoc", nearGeoPoint:userGeoPoint, withinMiles:50)
  query.limit = 2
  query.findObjectsInBackgroundWithBlock {
      (objects: [AnyObject]!, error: NSError!) -&gt; Void in
      if objects != nil {
          println("list of objects of nearby")
          println(objects)
          let searchString = "Sushi"
          let predicate = NSPredicate(format: "Type CONTAINS[cd] %@", searchString);
  
          //Line below gives error: '[AnyObject]' does not have a member named 'filteredArrayUsingPredicate'
          //let filteredArray = objects.filteredArrayUsingPredicate(predicate!)
  </code></pre>