title: How to sort NSPredicate
body: <p>I am trying to sort my array while using NSPredicate.. I have read other places that possibly using NSSortDescriptor could be an option. Having some trouble figuring this out.</p>
  
  <p>I am attempting to sort my array by companyName.</p>
  
  <p>Any advice appreciated, thanks</p>
  
  <p>Greg</p>
  
  <pre><code>- (void)filterSummaries:(NSMutableArray *)all byNameThenBooth:(NSString*) text results:(NSMutableArray *)results
  {
      [results removeAllObjects];
  
      if ((nil != text) &amp;&amp; (0 &lt; [text length])) {        
          if ((all != nil) &amp;&amp; (0 &lt; [all count])) {
              NSPredicate *predicate = [NSPredicate predicateWithFormat: @"companyName contains[cd] %@ OR boothNumber beginswith %@", text, text];
              [results addObjectsFromArray:[all filteredArrayUsingPredicate:predicate]];        
          }
      }
      else {
          [results addObjectsFromArray:all];
      }
  }
  </code></pre>