title: How to Update existing objects in Core Data?
body: <p>I'd like to update an object in Core Data. This is my code:</p>
  
  <pre><code>var detailTaskModel: TaskModel!
  detailTaskModel.date = dateFromDP         //update value
  
  let appDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
  appDelegate.saveContext()
  </code></pre>
  
  <p>I'm using a NSFetchedResultsController and Swift.</p>
  
  <p>Update:</p>
  
  <pre><code>var fetchedResultsController: NSFetchedResultsController = NSFetchedResultsController()
  </code></pre>
  
  <p>My func for loading the CoreData data:</p>
  
  <pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      var cell: TaskCell = tableView.dequeueReusableCellWithIdentifier("myCell") as TaskCell
  
      let thisTask = fetchedResultsController.objectAtIndexPath(indexPath) as TaskModel
      cell.textLabel?.text = thisTask.task
      return cell
  }
  </code></pre>
  
  <p>Saving CoreData:</p>
  
  <pre><code>let appDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
  let entityDescription = NSEntityDescription.entityForName("TaskModel", inManagedObjectContext: managedObjectContext!)
  let task = TaskModel(entity: entityDescription!, insertIntoManagedObjectContext: managedObjectContext!)
  task.task = labelText
  </code></pre>