How to fetchChanges from iCloud?

How to fetchChanges from iCloud?

My app have a local cache, I want to fetch changes from where it last interacted with iCloud.

1). use a predicate using own condition like id or date field in the data type? (id > maxId)

2). use the apple changedToken by saving it on disk every time after fetchChagnes completed?

what is the changeToken dataType here?

let changeToken = … // Read change token from disk

Replies

in the sample code, using class BaseLocalCache to read/write changeToken, was it neccessary? overskill?

let serverChangeToken = performReaderBlockAndWait { return database.serverChangeToken }

I was trying what Apple did, but no success.


Xcode version 9.4

https://developer.apple.com/library/archive/samplecode/CloudKitShare/Introduction/Intro.html