I am trying to implement a delete functionality in my app allowing users to delete information stored in core data and presented through a table view.
here is my cod
Delete the core data item and let the delegate callbacks take care of deleting the table view row:
if editingStyle == .Delete {
let item = self.fetchedResultsController.objectAtIndexPath(indexPath) as NSManagedObject
self.managedObjectContext.deleteObject(item)
}
The row deletion happens in the delegate callback controller:didChangeObject:atIndexPath:
forChangeType:newIndexPath:
if type == .Delete {
self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}