title: Won't save the int in coredata swift
body: <p>I want to save a Int into my core data, Now i do this this way but it crashes on the Int and only saves 1 item. </p>
  
  <pre><code>let appDel: AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
  
  let context: NSManagedObjectContext = appDel.managedObjectContext!
  let ent = NSEntityDescription.entityForName("Groups", inManagedObjectContext: context)
  
  var newItem = Groups(entity: ent!, insertIntoManagedObjectContext: context)
  </code></pre>
  
  <p><strong>My code</strong></p>
  
  <pre><code>if let groups : AnyObject! = json {
      //println(groups["groups"])
  
      var group = groups["groups"] as NSArray
  
      for g in group{
  
          newItem.id = g["id"] as Int
          newItem.name = g["name"] as NSString
  
          context.save(nil)
          println(newItem)
  
          println(g["id"] as Int)
          //println(g["name"] as NSString)
      }
  }
  </code></pre>
  
  <p><strong>Model:</strong>  </p>
  
  <pre><code>@objc(Groups)
  class Groups: NSManagedObject {
  
      @NSManaged var id:Int
      @NSManaged var name:String
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/R9skl.png" alt="enter image description here"></p>
  
  <p><strong>Consolelog:</strong></p>
  
  <pre><code>nil
  &lt;NSManagedObject: 0x7fe0c9f2f520&gt; (entity: Groups; id: 0xd000000000140000 &lt;x-coredata://1405B706-2AC6-4CED-BED5-FE0232723976/Groups/p5&gt; ; data: {
      "group_id" = nil;
      id = 0;
      name = Press;
  })
  1
  &lt;NSManagedObject: 0x7fe0c9f2f520&gt; (entity: Groups; id: 0xd000000000140000 &lt;x-coredata://1405B706-2AC6-4CED-BED5-FE0232723976/Groups/p5&gt; ; data: {
      "group_id" = nil;
      id = 0;
      name = Sales;
  })
  2
  &lt;NSManagedObject: 0x7fe0c9f2f520&gt; (entity: Groups; id: 0xd000000000140000 &lt;x-coredata://1405B706-2AC6-4CED-BED5-FE0232723976/Groups/p5&gt; ; data: {
      "group_id" = nil;
      id = 0;
      name = "Other information";
  })
  3
  </code></pre>