title: Objective-C: Circular Protocol Requirements
body: <p>I have 2 view controllers, an object picker and an object editor. Both of these objects have their own protocols to allow the presenters to receive data &amp; dismiss them.</p>
  
  <p>The editor sometimes needs to present a picker, and the picker needs to sometimes allow objects to be edited.</p>
  
  <p>The problem is that there is a circular protocol dependancy, and as the objects have to conform to the protocols, declaration forwarding doesn't work (you still get compiler warnings). </p>
  
  <p>I'm not just declaring an ivar that needs to conform to it, the whole picker/editor class needs to conform, thus the headers need the full information on the protocols.</p>
  
  <p>I get a <code>Cannot find protocol definition for 'EditorDelegate'</code> error.</p>
  
  <p>Here's an example:</p>
  
  <p><strong>Picker.h</strong></p>
  
  <pre><code>#import "Editor.h"
  @protocol PickerDelegate;
  @interface Picker : UIViewController &lt;EditorDelegate&gt; {
      id &lt;PickerDelegate&gt; delegate;
  }
  @protocol PickerDelegate &lt;NSObject&gt;
  - (void)picker:(Picker *) wasDismissedWithObject:(id)object;
  @end
  </code></pre>
  
  <p><strong>Editor.h</strong></p>
  
  <pre><code>#import "Picker.h"
  @protocol EditorDelegate;
  @interface Editor : UIViewController &lt;PickerDelegate&gt; {
      id &lt;EditorDelegate&gt; delegate;
  }
  @protocol EditorDelegate &lt;NSObject&gt;
  - (void)editor:(Editor *) dismissedAfterEditingObject:(id)object;
  @end
  </code></pre>
  
  <p>How can this be overcome?</p>