-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCollectionsKeyValueFiltering.h
More file actions
43 lines (32 loc) · 1.27 KB
/
CollectionsKeyValueFiltering.h
File metadata and controls
43 lines (32 loc) · 1.27 KB
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
//
// CollectionsKeyValueFiltering.h
//
//
// Copyright (c) 2010-2013 Nicolas Bouilleaud.
// http://bou.io/FilteringNSArrayWithKeyValueCoding
//
#import <Foundation/Foundation.h>
@interface NSArray (KeyValueFiltering)
/*
* KVC related addition : find and return the first object in the array whose value for keypath *keypath* is equal to *value*.
* will return nil if no such object is found.
*/
- (id) firstObjectWithValue:(id)value forKeyPath:(NSString*)keypath;
/*
* KVC related addition : find and return the objects in the array whose value for keypath *keypath* is equal to *value*.
* will return an empty array if no such object is found.
*/
- (NSArray*) filteredArrayWithValue:(id)value forKeyPath:(NSString*)keypath;
@end
@interface NSSet (KeyValueFiltering)
/*
* KVC related addition : find and return the first object in the array whose value for keypath *keypath* is equal to *value*.
* will return nil if no such object is found.
*/
- (id) anyObjectWithValue:(id)value forKeyPath:(NSString*)keypath;
/*
* KVC related addition : find and return the objects in the array whose value for keypath *keypath* is equal to *value*.
* will return an empty array if no such object is found.
*/
- (NSSet*) filteredSetWithValue:(id)value forKeyPath:(NSString*)keypath;
@end