forked from sumitmundra/MBJSONModel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MBValueTransformer.h
executable file
·28 lines (20 loc) · 1 KB
/
MBValueTransformer.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
//
// MBValueTransformer.h
//
#import <Foundation/Foundation.h>
typedef id (^BGMValueTransformerBlock)(id);
//
// A value transformer supporting block-based transformation.
//
@interface MBValueTransformer : NSValueTransformer
@property (nonatomic, copy, readonly) BGMValueTransformerBlock forwardBlock;
@property (nonatomic, copy, readonly) BGMValueTransformerBlock reverseBlock;
// Returns a transformer which transforms values using the given block. Reverse
// transformations will not be allowed.
+ (instancetype)transformerWithBlock:(BGMValueTransformerBlock)transformationBlock;
// Returns a transformer which transforms values using the given block, for
// forward or reverse transformations.
+ (instancetype)reversibleTransformerWithBlock:(BGMValueTransformerBlock)transformationBlock;
// Returns a transformer which transforms values using the given blocks.
+ (instancetype)reversibleTransformerWithForwardBlock:(BGMValueTransformerBlock)forwardBlock reverseBlock:(BGMValueTransformerBlock)reverseBlock;
@end