title: Lazy loading Objective-C class with int properties
body: <p>I use the following as a getter for a property in one of my classes:</p>
  
  <pre><code>- (NSString *)version
  {
      if (_version == nil) {
          _version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
      }
      return _version;
  }
  </code></pre>
  
  <p>This works well.  However, when I try the same for an int property I obviously get an error since int are never nil.  What is the best way around this?</p>
  
  <pre><code>- (int)numberOfDays
  {
      if (_numberOfDays == nil) {
          // relatively memory intense calculation that works out numberOfDays:
          _numberOfDays = X;
      }    
      return _numberOfDays;
  }
  </code></pre>