title: NSSortDescriptor: Custom comparison on multiple keys simultaneously
body: <p>I have an custom object which contains time period based information, for instance the attributes endCalYear, endMonth and periodLength which indicate the end of each period and its length.</p>
  
  <p>I would like to create an <code>NSSortDescriptor</code> based or other sorting method which combines these three attributes and allows sorting this object on all three keys at the same time.</p>
  
  <p>Example:</p>
  
  <pre><code>EndCalYear  endMonth  periodLength (months) sortOrder
  2012        6         6                     1
  2012        6         3                     2
  2012        3         3                     3
  2011        12        12                    4
  </code></pre>
  
  <p>The sort algorithm would be completely discretionary based on my own algorithm. </p>
  
  <p>How could I code such an algorithm? </p>
  
  <p>The block based <code>sortDescriptorWithKey:ascending:comparator:</code> method won't work in my view because it would allow me to specify only one sorting key. However, I need to sort on all three keys at the same time.</p>
  
  <p>Any ideas or thoughts on how to solve this?</p>
  
  <p>Thank you!</p>