title: How to declare an immutable property backed by a mutable type?
body: <p>I’d like to declare a public immutable property:</p>
  
  <pre><code>@interface Foo
  @property(strong, readonly) NSSet *items;
  @end
  </code></pre>
  
  <p>…backed with a mutable type in the implementation file:</p>
  
  <pre><code>@interface Foo (/* private interface*/)
  @property(strong) NSMutableSet *items;
  @end
  
  @implementation
  @synthesize items;
  @end
  </code></pre>
  
  <p>What I want is a mutable collection in the implementation that gets cast into an immutable one when accessed from the outside. (I don’t care that the caller can cast the instance back to <code>NSMutableSet</code> and break the encapsulation. I live in a quiet, decent town where such things don’t happen.)</p>
  
  <p>Right now my compiler treats the property as <code>NSSet</code> inside the implementation. I know there are many ways to get it working, for example with custom getters, but is there a way to do it simply with declared properties?</p>