I was hoping someone could help me understand the syntax of blocks when used as members of a class. I have a code that really works fine:
@class Structure; typedef void (^StructureDeleteCallback)(Structure *); @interface StructureListDelegate : NRFCTableDelegate { StructureDeleteCallback _structureDeleteCallback; } @property (nonatomic, copy) StructureDeleteCallback structureDeleteCallback; @end
This works, but I would like to understand the syntax of the typedef statement; and is it really necessary to use typedef.
What I read, it is recommended to use typedef in this situation, because it makes the code much more understandable; but I could not compile it at all when I tried to do this without a typedef . My understanding of typedef was that the syntax was basically:
typedef [actual type] [new name for type];
For example:
typedef double CLLocationDegrees;
But the syntax of my typedef statement does not match this. So my questions are:
- How will the syntax of my
typedef statement be different from other typedef statement / what syntax that I use actually means compiler? - Is it possible to have a block as a member of a class without using
typedef ?
objective-c typedef ios4 objective-c-blocks
Gendoikari
source share