title: Lightweight coredata migration Issue in Swift
body: <p>I have implemented core data migration as I needed to add a new attribute to my CoreData model.</p>
  <p>All I basically did was:</p>
  <ol>
  <li>Create new model version.</li>
  <li>Edit new model version.</li>
  <li>Set the options NSMigratePersistentStoresAutomaticallyOption and
  NSInferMappingModelAutomaticallyOption to YES upon creation of the
  persistentStoreCoordinator.</li>
  <li>Setting the current version to the new
  version.</li>
  </ol>
  <p>Then I added the attribute to <code>NSManagedObject</code> Class:</p>
  <pre><code>extension Clip {
  
      @nonobjc public class func fetchRequest() -&gt; NSFetchRequest&lt;Clip&gt; {
          return NSFetchRequest&lt;Clip&gt;(entityName: &quot;Clip&quot;)
      }
  
      @NSManaged public var text: String?
      @NSManaged public var date: String?
      @NSManaged public var hidden: NSNumber?
      @NSManaged public var desc: String?
      @NSManaged public var pinned: NSNumber?
  
      @NSManaged public var tag: String?  //new
  }
  
  </code></pre>
  <p>I am saving new items to core data like this:</p>
  <pre><code>
      var filteredClips = [Clip]()
  
      func appendNewItem(text: String, desc: String?){
          let entityDescription = NSEntityDescription.entity(forEntityName: &quot;Clip&quot;, in: managedContext)!
          let newItem = Clip.init(entity: entityDescription, insertInto: managedContext)
          newItem.text = text.trimmingCharacters(in: .whitespacesAndNewlines)
          newItem.date = getDate()
          newItem.desc = desc
          newItem.tag = &quot;favourite&quot; //new attribute
          newItem.hidden = false
          filteredClips.append(newItem)
          
          try! managedContext.save()
      }
  </code></pre>
  <p>Item cannot be added to the coredata Array.
  I'm getting this error message at launch:</p>
  <pre><code>&quot;Failed to call designated initializer on NSManagedObject class 'Clip'&quot;
  </code></pre>
  <p><strong>Update</strong></p>
  <p>I don't think the error message is related to this issue as this shows up even when the migration steps are undone.</p>