summaryrefslogtreecommitdiff
path: root/Pods/BlocksKit/BlocksKit/BKGlobals.h
blob: 401da3a7766d4f7eb6ed1946117969b046b3a5de (plain)
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
56
57
58
59
60
61
62
63
64
65
66
//
//  BKGlobals.h
//  BlocksKit
//

#import <dispatch/dispatch.h>
#import <Foundation/Foundation.h>

#import "A2BlockDelegate.h"
#import "NSObject+A2DynamicDelegate.h"

#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))
#define BK_HAS_UIKIT 0
#define BK_HAS_APPKIT 1
#elif (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
#define BK_HAS_UIKIT 1
#define BK_HAS_APPKIT 0
#else
#define BK_HAS_UIKIT 0
#define BK_HAS_APPKIT 0
#endif

#ifndef DEPRECATED_ATTRIBUTE_M
#if __has_attribute(deprecated)
#define DEPRECATED_ATTRIBUTE_M(...) __attribute__((deprecated(__VA_ARGS__)))
#else
#define DEPRECATED_ATTRIBUTE_M(...) DEPRECATED_ATTRIBUTE
#endif
#endif

#import <Foundation/Foundation.h>

#if BK_HAS_APPKIT
#import <Cocoa/Cocoa.h>
#endif

#if BK_HAS_UIKIT
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>

typedef void (^BKGestureRecognizerBlock)(UIGestureRecognizer *sender, UIGestureRecognizerState state, CGPoint location);
typedef void (^BKTouchBlock)(NSSet* set, UIEvent* event);
#endif

typedef void (^BKBlock)(void); // compatible with dispatch_block_t
typedef void (^BKSenderBlock)(id sender);
typedef void (^BKSenderKeyPathBlock)(id obj, NSString *keyPath);
typedef void (^BKKeyValueBlock)(id key, id obj);
typedef void (^BKIndexBlock)(NSUInteger index);
typedef void (^BKTimerBlock)(NSTimeInterval time);
typedef void (^BKResponseBlock)(NSURLResponse *response);

typedef void (^BKObservationBlock)(id obj, NSDictionary *change);
typedef void (^BKMultipleObservationBlock)(id obj, NSString *keyPath, NSDictionary *change);

typedef BOOL (^BKValidationBlock)(id obj);
typedef BOOL (^BKKeyValueValidationBlock)(id key, id obj);
typedef BOOL (^BKIndexValidationBlock)(NSUInteger index);

typedef id (^BKReturnBlock)(void);
typedef id (^BKTransformBlock)(id obj);
typedef id (^BKKeyValueTransformBlock)(id key, id obj);
typedef id (^BKAccumulationBlock)(id sum, id obj);
typedef id (^BKIndexMapBlock)(NSUInteger index);

typedef NSUInteger (^BKIndexTransformBlock)(NSUInteger index);