inessential by Brent Simmons

More About Deleting Objects in Core Data

Marcus Zarra:

Watch for notifications on objects that can be deleted under you. React to those notifications. Plan for them. Presenting an edit view and the object is deleted? React!

The one tricky case in Vesper I have to deal with is, as I wrote about, the case where the sync server tells the app that a note has been deleted — while that note is displayed in the detail view.

But, as Marcus points out, this is fairly easily dealt with. I’ll send a custom notification when that note is about to be deleted. The detail view will watch for that notification and do the right thing (which includes dropping its reference to that note). Then the note will be deleted.

So: not tricky at all.

(The only other issue is the timeline, but NSFetchedResultsController — again, as Marcus points out — deals with that quite nicely.)