swift - Master-Detail View Controller and CoreData -
as new swift, trying work master view controller read blog using json , store in core data. except don't understand how data gets deleted core data upon right swipe , delete. sorry ask such question , embarrassing. know sure following code deletes cant find implementation nor understand how knows entity delete data from.
func controller(controller: nsfetchedresultscontroller, didchangeobject anobject: anyobject, atindexpath indexpath: nsindexpath?, forchangetype type: nsfetchedresultschangetype, newindexpath: nsindexpath?) { switch type { case .insert: tableview.insertrowsatindexpaths([newindexpath!], withrowanimation: .fade) case .delete: *tableview.deleterowsatindexpaths([indexpath!], withrowanimation: .fade)* case .update: self.configurecell(tableview.cellforrowatindexpath(indexpath!)!, atindexpath: indexpath!) case .move: tableview.deleterowsatindexpaths([indexpath!], withrowanimation: .fade) tableview.insertrowsatindexpaths([newindexpath!], withrowanimation: .fade) default: return } }
please me understand how work. in advance help.
there's nothing in code deletes core data. code calls methods on uitableview
. tells table view delete row screen has no effect on core data.
you delete data core data using nsmanagedobjectcontext
' deleteobject:
method.