title: Help me sort NSMutableArray full of NSDictionary objects - Objective C
body: <p>I have an NSMutableArray full of NSDictionary objects. Like so</p>
  
  <pre><code>NSMutableArray *names = [[NSMutableArray alloc] init];
  for (NSString *string in pathsArray) {
      NSString *path = [NSString stringWithFormat:@"/usr/etc/%@",string];
      NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:string,@"name",path,@"path",nil];
  }
  </code></pre>
  
  <p>pathsArray is not sortable, so I'm stuck with the order of objects inside of it.  I would like to sort the names array in alphabetical order of the objects for the key: @"name" in the dictionary.  Can this be done easily or will it take several levels of enumeration?</p>
  
  <p>EDIT:  I Found the answer on SO in this question: <a href="https://stackoverflow.com/questions/3556801/sort-nsmutablearray">Sort NSMutableArray</a></p>
  
  <p>NSSortDescriptor class.</p>
  
  <pre><code>NSSortDescriptor *sortName = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
  [names sortUsingDescriptors:[NSArray arrayWithObject:sortName]];
  [sortName release];
  </code></pre>
  
  <p>Anyone care to get some free answer points?</p>