Let's say we want to store SomeBlock
typedef void(^SomeBlock)(void);
in a private member variable of an object of type SomeClass in order to store it and run it later. We could do it this way:
//SomeClass.m
@implementation SomeClass{
SomeBlock _someBlock;
}
//some code
@end
or we could do it this way:
//SomeClass.m
@interface SomeClass()
@property (nonatomic, copy) SomeBlock someBlock;
@end
According to http://goshdarnblocksyntax.com/, the latter is preferable. Why? Both examples are functional, but I wonder if there's some sort of memory implications I don't understand. There was some discussion around it in a non-ARC environment here: Saving a block in instance variable, but I am interested in using blocks as member variables in an ARC environment.