title: What are the functional differences between Coredata's CodeGen 'manual/none + create NSManagedObject subclass' vs. 'category/extension'
body: <p>I've read <a href="https://stackoverflow.com/questions/37905456/subclassing-nsmanagedobject-with-swift-3-and-xcode-8-beta/37905573#37905573">Subclassing NSManagedObject with swift 3 and Xcode 8 beta</a> and read <a href="https://www.hackingwithswift.com/read/38/4/creating-an-nsmanagedobject-subclass-with-xcode" rel="noreferrer">this</a> great tutorial. Still have questions on some points.</p>
  
  <h2>The similarities are:</h2>
  
  <ol>
  <li>I can customize both classes however I like.</li>
  <li>I can add new attributes or remove or rename attributes. ie for <code>category/extension</code> it will get updated upon a new build (in the derived data), and in case of <code>manual/none</code> it will leave the class file intact and update the extension in the file navigation ie I won't end up with a duplicate file. This is all handled by Xcode because they are marked with a preprocessor <code>@NSManaged</code></li>
  <li>Dumping something like <code>@NSManaged public var name: String?</code> straight into an existing <code>NSManagedObject</code> subclass is not allowed. I tried to do  <code>entity.name = "John"</code> but I got the following error:  <code>reason: '-[SomeEntity setName:]: unrecognized selector sent to instance 0x60400009b120'</code>. I believe that's reasonable. I think without using the Core Data Model Editor the setter/getter accessor methods are not created. </li>
  </ol>
  
  <h1>The differences are:</h1>
  
  <ol start="4">
  <li>For <code>Category/Extension</code> you just need to create the class yourself and add any extra functions/properties you need. </li>
  <li><p>For <code>Category/Extension</code> the attributes are created in derived data which is enough. Because you never need to see that file. Its existence is enough to get things working.</p>
  
  <p> And specifically in the context of making <em>changes</em> to your NSManaged properties: </p></li>
  <li><p>Changing property type, e.g. <code>NSDate</code> to <code>Date</code> is allowed only for <code>Manual/None</code> . Example <a href="https://www.hackingwithswift.com/read/38/4/creating-an-nsmanagedobject-subclass-with-xcode" rel="noreferrer">here</a></p></li>
  <li>Changing optionality of a type, e.g. <code>String?</code> to <code>String</code> is allowed only for <code>Manual/None</code>. Example <a href="https://www.hackingwithswift.com/read/38/4/creating-an-nsmanagedobject-subclass-with-xcode" rel="noreferrer">here</a></li>
  <li><p>Changing a property access level, e.g. from <code>public</code> to <code>private</code> is allowed only for <code>Manual/None</code>. Example <a href="https://medium.com/@kahseng.lee123/core-data-codegen-explained-462c30341041" rel="noreferrer">here</a></p></li>
  <li><p>Having that said there is significant difference <em>if</em> I choose <code>Manual/None</code> codegen and but <strong>don't</strong> select 'create NSManagedObject subclass'. In that case I have start writing all the code myself (subclass from NSManagedObject and write NSManaged for every property)...or if I don't write all that code myself then I can still access/set fields using KVC which is awkward!</p></li>
  </ol>
  
  <p>In a nutshell I'm just trying to figure out the full extent of capabilities that I can get from using <code>Manual/None</code>. </p>
  
  <p><strong>Question:</strong> Aside from the 9 <em>notes</em> which I need to know if I have validated correctly, an important <em>question</em> would be: how does me changing <code>NSDate</code> to <code>Date</code> or optional to non-optional not break the mappings between my NSManagedObject class and my object graph all while changing an <code>NSDate</code> property to <code>String</code> does break!! Does this have something to do with things that have guaranteed casting between Swift and Objective-C ie things that can be casted through <code>as</code> — without <code>?</code> or <code>!</code>?</p>