In heightened disappointment, I made a macro consolidating this crude process.
#define BlockProperty(SIGNATURE,TYPENAME,varname,Varname) typedef SIGNATURE; @property (nonatomic,copy) TYPENAME varname; - (void) set##Varname:(TYPENAME)_
Now, what would be required before (for correct autocomplete).
typedef void(^OnEvent)(BOOL ok,id result); @property (nonatomic,copy) OnEvent varname; - (void) setVarname:(OnEvent)_;
just
BlockProperty(void(^OnEvent)(BOOL ok, id result),OnEvent,varname,VarName);
QUITE is a bit simpler, less verbose, and you benefit from typedef AND, and you don't need to create an unsightly theoretical unnecessary setter declaration!
If you want to reuse the “type”, you will need another (which this time will only accept three parameters (since the block type cannot be updated).
#define BlockProp(TYPENAME,varname,Varname) @property (nonatomic,copy) TYPENAME varname; - (void) set##Varname:(TYPENAME)_ BlockProp(OnEvent,anotherVar,AnotherVar);
You can simply create a new block type (name) for each property, even if their signatures match (using the first macro), but this kind of gross. Enjoy it!