- All content created and modified on a device is sent to a web API.
- A device notifies the API of any deleted content.
- The API makes all created and modified content available to all devices.
- The API notifies all devices about content that has been deleted and should be purged.
Before beginning this task we read as much as we could on the topic, notably this issue of objc.io and the diary Brent Simmons kept while adding sync support to Vesper, itself a note taking app. Both of these sources gave us food for thought; the latter was also the inspiration for this very series. If you’re exploring the topic yourself, they are highly recommended reading.
Making it smart
One from many
Fetch all records which are used to contextualise notes (labels, contacts, etc.).
- Push all new notes which have been created on the device.
- Push all notes which already exist on the server but have been modified on the device.
- Push “tombstone” records for any notes that exist on the server but have been deleted on the device.
- Fetch any new or modified notes
- Fetch any “tombstone” records for notes deleted on the server