Can I use Objective-C blocks as properties?

automatic-ref-counting, ios, objective-c, objective-c-blocks

Solution

@property (nonatomic, copy) void (^simpleBlock)(void);
@property (nonatomic, copy) BOOL (^blockWithParamter)(NSString *input);

If you are going to be repeating the same block in several places use a type def

typedef void(^MyCompletionBlock)(BOOL success, NSError *error);
@property (nonatomic) MyCompletionBlock completion;

Problem

Is it possible to have blocks as properties using the standard property syntax? Are there any changes for ARC?

Original source

Related problems