nsscreencast / comments

Public comments on NSScreencast.com
0 stars 0 forks source link

Core Data in iOS 10 - NSScreencast #160

Open subdigital opened 3 years ago

subdigital commented 3 years ago

Written on 11/12/2017 07:27:31

URL: https://nsscreencast.com/episodes/238-core-data-in-ios-10

subdigital commented 3 years ago

originally written by Sam on 01/22/2017 07:04:30

Reduce looks great, but what if record was deleted from the server? How can delete these episodes from my CoreData?

subdigital commented 3 years ago

originally written by subdigital on 01/22/2017 18:38:36

Sync is a different (and complex) problem to solve, but there are a few cases you can consider:

1) Include a list of `deleted_episode_ids` in the API response, which doesn't really scale well. It also requires that the server not actually delete things, instead keeping track of a deleted flag.

2) Have the client send a list of ids that it has, and the server returns a list of ones that are no longer valid. Similar to the above, but you don't have to keep deleted records around. This also doesn't scale super well, but for most applications this is probably sufficient.

3) Keep a change log of inserts / updates, deletes, etc and replay those on the client. That is less of a CRUD-style API and more of a custom sync solution.

If it were me I'd do #2 until that because infeasible due to the amount of data being sent. (tens of thousands of records or more).