title: Objective-C: Property / instance variable in category
body: <p>As I cannot create a synthesized property in a Category in Objective-C, I do not know how to optimize the following code:</p>
  
  <pre><code>@interface MyClass (Variant)
  @property (nonatomic, strong) NSString *test;
  @end
  
  @implementation MyClass (Variant)
  
  @dynamic test;
  
  - (NSString *)test {
      NSString *res;
      //do a lot of stuff
      return res;
  }
  
  @end
  </code></pre>
  
  <p>The <em>test-method</em> is called multiple times on runtime and I'm doing a lot of stuff to calculate the result. Normally using a synthesized property I store the value in a IVar _test the first time the method is called, and just returning this IVar next time. How can I optimized the above code?</p>