title: Swift + CoreData: Cannot Automatically Set Optional Attribute On Generated NSManagedObject Subclass
body: <p>I have a coredata entity named Record and has a property dateUpdated. I noticed that the generated NSManagedObject subclass has no optional mark (?)</p>
  
  <p><strong>CoreData Editor:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/mDD3a.png" alt="enter image description here"></p>
  
  <p><strong>Generated Subclass:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/L1YYw.png" alt="enter image description here"></p>
  
  <p><strong>Expected:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/9PwaM.png" alt="enter image description here"></p>
  
  <p><strong>UPDATED:</strong> 
  It's <strong>tedious</strong> in my part, because each time I want to regenerate the subclasses, it means I also need to update all optional values manually. Having a non-optional (without '?') in subclass lead me to check evalue before assigning, like example below:</p>
  
  <pre><code>// sample value:
  // serverDateFormatter = "yyyy/MM/dd"
  // dateString = ""    
  
  // Branch is a subclass of Record (see above images)
  
  var date = self.coreData.serverDateFormatter.dateFromString(dateString)
  if date != nil
  {
     branch.dateUpdated = date 
  }
  </code></pre>
  
  <p>But if xcode can automatically set optional value in subclass with (?) I just need to do like this:</p>
  
  <pre><code>branch.dateUpdated = self.coreData.serverUTCDateFormatter.dateFromString(dateString)
  </code></pre>
  
  <p>In my case, I have bunch of properties I need to mark as optional manually.</p>