title: Sorting NSMutableArray By Object's Property
body: <p>So this is a rather basic question regarding the best way to sort an <code>NSMutableArray</code> of custom objects.</p>
  
  <p>I have a an <code>NSMutableArray</code> of custom objects, each object with an <code>NSString</code> and <code>NSDate</code> that go together. I need to sort the array by the newest object (so latest <code>NSDate</code>), and I'm pretty sure I could simply use <code>NSDate compare: NSDate</code> if this was an array of just <code>NSDate</code>, but since I need all objects to be sorted and not just the date, I'm not sure if I can use that method.</p>
  
  <p>In terms of pseudo-code, I need to: Look at individual object, determine if the current object's <code>NSDate</code> is the next biggest in the array, and if it is, move the object, not just the date.</p>
  
  <p>Again, this is something I was even hesitant to ask since it's so basic but I don't want to go writing some grossly inefficient method if there is a pre-existing class method that will essentially do what I want, search an array of object's sub properties and sort the objects according to the subproperties.</p>
  
  <p>Thanks for any help.</p>