title: Perform search through array in background thread?
body: <p>I have a pretty large array I get from my database <code>peopleArray</code> that consists of all the users of my app. This array is used for searching for friends. My problem is, when the user begins to type in the search bar the app often freezes for a moment before display the searched user.</p>
  
  <pre><code> #pragma mark - SEARCH BAR
  
  - (void) filterContententForSearchText: (NSString *) searchText scope:(NSString *) scope{
  NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K beginsWith[cd] %@",@"Name", searchText ];
  self.searchArray = [self.peopleArray filteredArrayUsingPredicate:predicate];
  }
  
  - (BOOL) searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString{
  [self filterContententForSearchText:searchString scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
  return YES;
  }
  
  - (void) searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller{
  [self.tableView reloadData];
  }
  </code></pre>
  
  <p>I would like to do this in the background so I can put a <code>UIActivityIndicator</code> in the tableView as it loads but am not sure where or how to implement which method in the background.</p>