Skip to content

Instantly share code, notes, and snippets.

@egold
Created April 3, 2012 19:15
Show Gist options
  • Save egold/2294834 to your computer and use it in GitHub Desktop.
Save egold/2294834 to your computer and use it in GitHub Desktop.
Quickie NSArray sorting
NSSortDescriptor* sortByDate = [NSSortDescriptor sortDescriptorWithKey:@"createdDate" ascending:NO];
allReminders = [allReminders sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortByDate]];
self.reminders = [NSMutableArray arrayWithArray:allReminders];
@egold
Copy link
Author

egold commented Apr 3, 2012

There are more flexible ways to sort NSArrays using blocks or custom methods, but this covers 90% of cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment