title: iOS category conforms to a protocol with properties: how to implement
body: <p>I have a category on a class I made, and that category conforms to a protocol, which requires a property in its implementation. However, because I'm in a category, I cannot synthesize the property in the implementation of the category. Because of this, I'm stumped on how to implement the setter method (when I keep the protocol's property readonly it works fine, since all I need is an accessor method). </p>
  
  <p>This is my protocol:</p>
  
  <pre><code>@protocol SomeProtocol &lt;NSObject&gt;
  @property (nonatomic) BOOL didDisplayRecommendation;
  @end
  </code></pre>
  
  <p>I know if I do this I'll get an infinite loop: </p>
  
  <pre><code>- (void)setDidDisplayRecommendation:(BOOL)didDisplayRecommendation
  {
      self.didDisplayRecommendation = didDisplayRecommendation;
  }
  </code></pre>
  
  <p>But when I try this I get a compiler error: </p>
  
  <pre><code>- (void)setDidDisplayRecommendation:(BOOL)didDisplayRecommendation
  {
      _didDisplayRecommendation = didDisplayRecommendation;
  }
  </code></pre>
  
  <p>Note that didDisplayRecommendation is the property in the protocol. What's the best way of getting around this? Thanks in advance!</p>