title: Sorting an array of Objective-c objects
body: <p>So I have a custom class <code>Foo</code> that has a number of members:</p>
  
  <pre><code>@interface Foo : NSObject {
      NSString *title;
      BOOL     taken;
      NSDate   *dateCreated;
  }
  </code></pre>
  
  <p>And in another class I have an <code>NSMutableArray</code> containing a list of these objects. I would very much like to sort this array based on the <code>dateCreated</code> property; I understand I could write my own sorter for this (iterate the array and rearrange based on the date) but I was wondering if there was a proper Objective-C way of achieving this? </p>
  
  <p>Some sort of sorting mechanism where I can provide the member variable to sort by would be great. </p>
  
  <p>In C++ I used to overload the &lt; = > operators and this allowed me to sort by object, but I have a funny feeling Objective-C might offer a nicer alternative?</p>
  
  <p>Many thanks</p>