I was hoping someone could help me understand the syntax of blocks when used as members of a class. I have some code that's actually working just 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 whether or not it's actually required to use typedef.
What I've read says that using typedef
in this situation is recommended because it makes the code a lot clearer; but I've been unable to get it to compile at all when trying to do this without typedef
. My understanding of typedef was that the syntax was basically:
typedef [actual type] [new name for type];
Such as:
typedef double CLLocationDegrees;
But the syntax of my typedef
statement doesn't match this. So my questions are:
typedef
statement be so different from other
typedef
statements / what does the syntax I'm using actually mean to the compiler?typedef
?I myself have asked a question along the lines of yours here: Block references as instance vars in Objective-C
See my answers here and here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With