Last active
June 23, 2016 00:53
-
-
Save apphands/4e658980319f278bbd17b8a1fa2450b0 to your computer and use it in GitHub Desktop.
Sort NSDictionary keys in descending order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDictionary *dict = @{@"a":@1, @"b":@3, @"z":@24}; | |
NSArray *sortedArray = [dict keysSortedByValueUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { | |
return [obj1 integerValue] < [obj2 integerValue]; | |
}]; | |
NSLog(@"dict: %@", sortedArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment