forked from BlocksKit/BlocksKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNSMutableArray+BlocksKit.h
More file actions
55 lines (39 loc) · 1.5 KB
/
Copy pathNSMutableArray+BlocksKit.h
File metadata and controls
55 lines (39 loc) · 1.5 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
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// NSMutableArray+BlocksKit.h
// BlocksKit
//
#import "BKDefines.h"
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/** Block extensions for NSMutableArray.
These utilities expound upon the BlocksKit additions to the immutable
superclass by allowing certain utilities to work on an instance of the mutable
class, saving memory by not creating an immutable copy of the results.
Includes code by the following:
- [Martin Schürrer](https://github.com/MSch)
- [Zach Waldowski](https://github.com/zwaldowski)
@see NSArray(BlocksKit)
*/
@interface __GENERICS(NSMutableArray, ObjectType) (BlocksKit)
/** Filters a mutable array to the objects matching the block.
@param block A single-argument, BOOL-returning code block.
@see <NSArray(BlocksKit)>bk_reject:
*/
- (void)bk_performSelect:(BOOL (^)(id ObjectType))block;
/** Filters a mutable array to all objects but the ones matching the block,
the logical inverse to bk_select:.
@param block A single-argument, BOOL-returning code block.
@see <NSArray(BlocksKit)>bk_select:
*/
- (void)bk_performReject:(BOOL (^)(id ObjectType))block;
/** Transform the objects in the array to the results of the block.
This is sometimes referred to as a transform, mutating one of each object:
[foo bk_performMap:^id(id obj) {
return [dateTransformer dateFromString:obj];
}];
@param block A single-argument, object-returning code block.
@see <NSArray(BlocksKit)>bk_map:
*/
- (void)bk_performMap:(id (^)(id ObjectType))block;
@end
NS_ASSUME_NONNULL_END