Skip to content

Instantly share code, notes, and snippets.

@jaisonv
Last active July 25, 2016 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaisonv/c10d38cbb2ccfbbca1b19f35d450e095 to your computer and use it in GitHub Desktop.
Save jaisonv/c10d38cbb2ccfbbca1b19f35d450e095 to your computer and use it in GitHub Desktop.
Sort array
// 'date' is the property with the date to be sorted by
NSSortDescriptor *dateDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:dateDescriptor];
// 'myArray' is the array that will be sorted
NSArray *sortedEventArray = [myArray sortedArrayUsingDescriptors:sortDescriptors];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment