Skip to content

Instantly share code, notes, and snippets.

@soltrinox
Created December 18, 2014 15:44
Show Gist options
  • Save soltrinox/da665e7a66531b524a24 to your computer and use it in GitHub Desktop.
Save soltrinox/da665e7a66531b524a24 to your computer and use it in GitHub Desktop.
OBJ-c comparator with blocks
NSArray *sortedArray;
sortedArray = [drinkDetails sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
NSDate *first = [(Person*)a birthDate];
NSDate *second = [(Person*)b birthDate];
return [first compare:second];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment