title: Issue with custom NSManagedObject class core data in swift
body: <p>I start to learn swift recently and I want to use some data model class written in Objective C. I got a weird bug when I try to save the data from input boxes: </p>
  
  <p>Users.h</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;CoreData/CoreData.h&gt;
  
  
  @interface Users : NSManagedObject
  
  @property (nonatomic, retain) NSString * password;
  @property (nonatomic, retain) NSString * username;
  
  - (NSString *)toString;
  - (void)addFunny:(NSString *)prefix;
  
  @end
  </code></pre>
  
  <p>Users.m</p>
  
  <pre><code>#import "Users.h"
  
  
  @implementation Users
  
  @dynamic password;
  @dynamic username;
  
  - (NSString *)toString
  {
      return @"The username is \(username) and password is \(password)";
  }
  
  - (void)addFunny:(NSString *)prefix
  {
      self.username = [NSString stringWithFormat:@"%@%@", prefix, self.username];
  }
  
  @end
  </code></pre>
  
  <p>Here is data model screenshot:</p>
  
  <p><img src="https://i.stack.imgur.com/KviIj.png" alt="data model">
  Here is the save function: </p>
  
  <pre><code>@IBAction func btnSave_Clicked(){
          println("Save \(txtUsername.text)")
  
          let appDel: AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
          let context: NSManagedObjectContext = appDel.managedObjectContext
          let ent = NSEntityDescription.entityForName("Users", inManagedObjectContext: context)
  
          var newUser = Users(entity: ent, insertIntoManagedObjectContext: context)
          newUser.username = txtUsername.text
          newUser.password = txtPassword.text
  
          context.save(nil)
          println(newUser)
  
      }
  </code></pre>
  
  <p>Code from lldb:</p>
  
  <pre><code>Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0xb736c50 {metadata={
      NSPersistenceFrameworkVersion = 508;
      NSStoreModelVersionHashes =     {
          Entity = &lt;b2bc8535 3bcfcdf1 81eecadc d32d8511 cc030525 d4eb7d76 94d11d7c f5853918&gt;;
      };
      NSStoreModelVersionHashesVersion = 3;
      NSStoreModelVersionIdentifiers =     (
          ""
      );
      NSStoreType = SQLite;
      NSStoreUUID = "0169C569-2A57-47F1-9EF6-684485CB1135";
      "_NSAutoVacuumLevel" = 2;
  }, reason=The model used to open the store is incompatible with the one used to create the store}, (error.userInfo)
  </code></pre>