blob: 15a8be746bd0f6af93a3d7c72ca767117fd8efdd (
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
|
//
// NSInvocation+BlocksKit.h
// BlocksKit
//
#import "BKGlobals.h"
/** BlocksKit extensions for NSInvocation. */
@interface NSInvocation (BlocksKit)
/** Generates an `NSInvocation` instance for a given block.
NSInvocation *invocation = [NSInvocation invocationWithTarget: target block: ^(id myObject){
[myObject someMethodWithArg:42.0];
}];
This returns an invocation with the appropriate target, selector, and arguments
without creating the buffers yourself. It is only recommended to call a method
on the argument to the block only once.
Created by [Jonathan Rentzch](https://github.com/rentzsch) as
`NSInvocation-blocks`.
@param target The object to "grab" the block invocation from.
@param block A code block.
@return A fully-prepared instance of NSInvocation ready to be invoked.
*/
+ (NSInvocation *)invocationWithTarget:(id)target block:(BKSenderBlock)block;
@end
|