<p>I am trying to create a delegate protocol for a custom UIView. Here is my first attempt:</p>

<pre><code>@protocol FunViewDelegate
@optional
- (void) funViewDidInitialize:(FunView *)funView;
@end


@interface FunView : UIView {    
@private
}

@property(nonatomic, assign) id&lt;FunViewDelegate&gt; delegate;

@end
</code></pre>

<p>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:</p>

<pre><code>@interface FunView;
</code></pre>

<p>But this just drives the compiler nuts. How am I supposed to do this?</p>

It would seem that you can forward declare protocols:
```
```
@protocol FunViewDelegate;

@interface FunView : UIView {    
@private
    id<FunViewDelegate> delegate;
}
@property(nonatomic, assign) id<FunViewDelegate> delegate;
@end

@protocol FunViewDelegate
@optional
- (void) funViewDidInitialize:(FunView *)funView;
@end
```
```