title: What does @NSManaged do?
body: <p>I have encountered this keyword in various occasions. I kind of know what it's suppose to do. But I really want a better understanding of it. </p>
  
  <p>What I noticed about <code>@NSManaged</code> - based not on documentation, but through repeated use:</p>
  
  <ol>
  <li>It magically replaces key value coding. </li>
  <li>It is roughly equivalent to <code>@dynamic</code> in Objective-C (which I don't know much about)</li>
  <li>I need it to subclass <code>PFObject</code> from the <code>Parse SDK</code>. It normally uses KVC to read/write values from/to the backend.</li>
  <li>Prefixing any variable with <code>@NSManaged</code> will shut the compiler up when I don't initialize within the initializer. </li>
  </ol>
  
  <p><strong>The formal definition (in the Core Data Apple Docs):</strong></p>
  
  <blockquote>
    <p>Core Data provides the underlying storage and implementation of properties in subclasses of the NSManagedObject class. Add the @NSManaged attribute before each property definition in your managed object subclass that corresponds to an attribute or relationship in your Core Data model. Like the @dynamic attribute in Objective-C, the @NSManaged attribute informs the Swift compiler that the storage and implementation of a property will be provided at runtime. However, unlike @dynamic, the @NSManaged attribute is available only for Core Data support.</p>
  </blockquote>
  
  <p><strong>What I got from that:</strong></p>
  
  <blockquote>
    <p>Variables with <code>@NSManaged</code> shall be exempt from compile time checks for <em>something</em>.</p>
  </blockquote>
  
  <p>I've read the formal documentation and various other SO questions regarding this matter:</p>
  
  <p><a href="https://stackoverflow.com/questions/1160498/synthesize-vs-dynamic-what-are-the-differences">@synthesize vs @dynamic, what are the differences?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/4524954/what-is-common-case-for-dynamic-usage/4524983#4524983">What is common case for @dynamic usage?</a></p>
  
  <p>I instinctively recognize <em>some</em> scenarios where I should use it. I <em>partially</em> know what it does. But what I seek is purer understanding of what it does. </p>
  
  <p><strong>Further Observations:</strong></p>
  
  <p>A <code>PFObject</code> in the <code>Parse SDK</code> relies on <code>Key Value Coding</code> to access its values. The <code>PFObject</code> provides the following accessors:</p>
  
  <p><code>objectForKey:</code>  </p>
  
  <pre><code>let score = results.objectForKey("descriptionOfResult") 
  //returns the descriptionOfResult value from the results object
  </code></pre>
  
  <p><code>setObject:forKey:</code></p>
  
  <pre><code>results.setObject("The results for a physics exam", forKey: "descriptionOfResult") 
  //sets the value of descriptionOfResult 
  </code></pre>
  
  <p>To my understanding, <code>@NSManaged</code> <em>magically</em> understands that the variable I've declared automatically uses the above accessors to <code>get</code> and <code>set</code>. I'd like to know how it does that (if what I understand is true), and whatever else it does.</p>