Reputation: 6092
I have been fiddling with CloudKit for some time now, but I can't find a real-life example for how to use CKRecordZone. I understand their capabilities (namely, grouping records, especially for subscriptions), but does someone have a real experience of having used them, and to map which concept ?
Thanks
Upvotes: 8
Views: 1213
Reputation: 30561
The Apple News app uses two zones in the private database for the user's information: ReadingList and ReadingHistory. ReadingList stores news article IDs that have been bookmarked; ReadingHistory stores news article IDs that have been read. By separating the article IDs into two different zones it allows them to be efficiently synced. For example, if an article is only read on a device (and not bookmarked), then the other device receives a notification that the ReadingHistory zone has changed, then it only has to sync that zone rather than both. For more info, you can read my full write up on the News app's syncing behavior here.
Upvotes: 7
Reputation: 181
CloudKit record zones give you three main benefits:
Upvotes: 6
Reputation: 6092
Also, it may be useful when you want to create a CKSubscription that monitors all records in a specified record zone (zone-based, instead of query-based).
Upvotes: 5