IOS 4 - Using Blocks as a Member of a Class

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 ?
+6
objective-c typedef ios4 objective-c-blocks
source share
1 answer

I myself asked the question as follows: Block links as vars instances in Objective-C

See my answers here and here .

+7
source share

All Articles