title: How to save data to model coredata
body: <p>I want to save my data to core data when a button is clicked here is my action button code now <code>let app = UIApplication.sharedApplication().delegate as! AppDelegate
              let context = app.managedObjectContext
              let entity = NSEntityDescription.entityForName("Cart", inManagedObjectContext: context)
              let cart = Cart(entity: entity!, insertIntoManagedObjectContext: context)</code> but the only problem now is that i dont how to save here is my code to parse json</p>
  
  <pre><code>      Alamofire.request(.GET, url!, headers: headers).responseJSON { (response) in
          let result = response.result
  
          if response.result.isSuccess{
              let jsonObj = JSON(result.value!)
              if let x = jsonObj["Items"].array {
                  x.forEach
                      {
                          if let uw = ($0["name"]).string{
                              print(uw)
                              let qw = ($0["image"]).string
                              if let rw = ($0["price"]).int{
                                  if let hu = ($0["id"]).int{
                                  print(hu)
                                  let foo = Rest(name: uw, imageUrl: qw!, price: "₦\(rw)")
                                      self.rest.append(foo)
  
                                  }
  
  
                              }
  
                          }
  
                  }
  
                  dispatch_async(dispatch_get_main_queue()) {
                      self.tableView.reloadData()
                      actInd.stopAnimating()
  
                  }
  
              }
  
          }
  </code></pre>
  
  <p>So i have an array called rest which is where i want get data for the tableview. I want to save information of each cell tapped into coredata here is a screenshot of the app<a href="https://i.stack.imgur.com/8Sw6a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Sw6a.png" alt="Screenshot"></a></p>
  
  <p>So when the sure button is tapped it saves the item to coredata
  here is my code incase you nee<a href="http://pastebin.com/Nf8aKhvn" rel="nofollow noreferrer">code</a></p>