title: Indexed NSFetchedResultsController
body: <p>How can I index a <code>NSFetchedResultsController</code> so that I can implement an A-Z index on a tableview. </p>
  
  <p>I see in the initializer I can do <code>sectionNameKeyPath</code> but this just places unique objects in their own section.</p>
  
  <p>Here is what I have for my <code>NSFetchedResultsController</code> </p>
  
  <pre><code>    - (NSFetchedResultsController *)fetchedResultsController
  {
      if (__fetchedResultsController != nil) {
          return __fetchedResultsController;
      }
  
      NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
  
      NSEntityDescription *entity = [NSEntityDescription entityForName:@"Customer" inManagedObjectContext:self.managedObjectContext];
      [fetchRequest setEntity:entity];
  
      [fetchRequest setFetchBatchSize:20];
  
      NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
      NSArray *sortDescriptors = [NSArray arrayWithObjects:sortDescriptor, nil];
  
      [fetchRequest setSortDescriptors:sortDescriptors];
  
      NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:@"name" cacheName:@"Customer"];
      aFetchedResultsController.delegate = self;
  
      self.fetchedResultsController = aFetchedResultsController;
  
      return __fetchedResultsController;
  }  
  </code></pre>