-
Notifications
You must be signed in to change notification settings - Fork 41
/
NSArray+SortDescriptorsHelp.h
46 lines (30 loc) · 1.14 KB
/
NSArray+SortDescriptorsHelp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import <Cocoa/Cocoa.h>
@interface NSArray (SortByKey)
/*!
@brief Returns an array consisting of a single sort descriptor, set
to sort ascending with -localizedCaseInsensitiveCompare: by a given key.
@details The objects in the array to which this sort descriptor
is applied must be strings. NSNumber does not respond to
-localizedCaseInsensitiveCompare:.
*/
+ (NSArray*)sortDescriptorsForStringValueForKey:(NSString*)key ;
/*!
@brief Returns a copy of the receiver, sorted by the value of
a given key using -localizedCaseInsensitiveCompare:
*/
- (NSArray*)arraySortedByStringValueForKey:(NSString*)key ;
/*!
@brief Returns a copy of the receiver, sorted by the value of
a given key using -compare:
@param details If keyPath is nil, defaults to @"description"
*/
- (NSArray*)arraySortedByKeyPath:(NSString*)keyPath ;
@end
@interface NSMutableArray (SortByKey)
/*!
@brief Sorts the array by a given key, using -localizedCaseInsensitiveCompare
@details Note that due to -localizedCaseInsensitiveCompare, this
is appropriate for strings but not for numbers.
*/
- (void)sortByStringValueForKey:(NSString*)key ;
@end