title: Better ways of sorting NSArray in Objective - C
body: <p>G'Day Everyone, </p>
  
  <p>Recently I have started learning iOS development. I initiated my learning process by learning Objective C language. Before I am proficient in Java, In natural computer sense "Java is my first language".</p>
  
  <p>Because of that I am having lots of difficulty when I see really long methods in Obj - C, Which meant to do really easy things. Let me share some codes which are very long just to sort NSArray content Ascending order and Descending order (Alphabetically)</p>
  
  <p><strong>Sort NSArray in Ascending order A - Z</strong></p>
  
  <hr />
  
  <pre><code>[dataToShow sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; // dataToShow is my NSArray
  </code></pre>
  
  <p><strong>Sort NSArray in Descending order Z - A</strong></p>
  
  <hr />
  
  <pre><code>NSSortDescriptor* sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:nil ascending:NO selector:@selector(localizedCompare:)];
  [dataToShow sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]; // dataToShow is my NSArray
  </code></pre>
  
  <p>Now is there any better way, By better way I mean shorter way of achieving same result? As I am naive, I would like to know if there is any other method which might be as long as above one but does sorting in more better ways.</p>
  
  <p>Thank you</p>