I am trying to create a delegate protocol for a custom UIView. Here is my first attempt:
@protocol FunViewDelegate @optional - (void) funViewDidInitialize:(FunView *)funView; @end @interface FunView : UIView { @private } @property(nonatomic, assign) id<FunViewDelegate> delegate; @end
This doesn’t work because the FunView interface has not been declared at the time of the FunViewDelegate declaration. I have tried adding a prototype ala C++ before the @protocol:
@interface FunView;
But this just drives the compiler nuts. How am I supposed to do this?
Forward class syntax is
@class Foo;, not@interface Foo;.