Yes, you can certainly keep a reference to a (copy) of the Objective-C block. A variable declaration is a little hairy, like C function pointers, but other than that, it's not a problem. For a block that takes id and returns void:
typedef void (^MyActionBlockType)(id); @interface MyClass : NSObject { } @property (readwrite,nonatomic,copy) MyActionBlockType myActionBlock; @end
will do the trick.
Barry Wark Jul 12 2018-10-12T00: 00Z
source share