title: Why would you use an ivar?
body: <p>I usually see this question asked the other way, such as <a href="https://stackoverflow.com/questions/5031230/ios-must-every-ivar-really-be-property">Must every ivar be a property?</a> (and I like bbum's answer to this Q).</p>
  
  <p>I use properties almost exclusively in my code.  Every so often, however, I work with a contractor who has been developing on iOS for a long time and is a traditional game programmer.  He writes code that declares almost no properties whatsoever and leans on ivars.  I assume he does this because 1.) he's used to it since properties didn't always exist until Objective C 2.0 (Oct '07) and 2.) for the minimal performance gain of not going through a getter / setter.</p>
  
  <p>While he writes code that doesn't leak, I'd still prefer him to use properties over ivars.  We talked about it and he more or less sees not reason to use properties since we weren't using KVO and he's experienced with taking care of the memory issues.</p>
  
  <p><strong>My question is more...  Why would you ever want to use an ivar period - experienced or not.  Is there really that great of a performance difference that using an ivar would be justified?</strong></p>
  
  <p>Also as a point of clarification, I override setters and getters as needed and use the ivar that correlates with that property inside of the getter / setter.  However, outside of a getter / setter or init, I always use the <code>self.myProperty</code> syntax.</p>
  
  <hr>
  
  <h2>Edit 1</h2>
  
  <p>I appreciate all of the good responses.  One that I'd like to address that seems incorrect is that with an ivar you get encapsulation where with a property you don't.  Just define the property in a class continuation.  This will hide the property from outsiders.  You can also declare the property readonly in the interface and redefine it as readwrite in the implementation like:</p>
  
  <pre><code>// readonly for outsiders
  @property (nonatomic, copy, readonly) NSString * name;
  </code></pre>
  
  <p>and have in the class continuation:</p>
  
  <pre><code>// readwrite within this file
  @property (nonatomic, copy) NSString * name;
  </code></pre>
  
  <p>To have it completely "private" only declare it in the class continuation.</p>