How should we handle history tracking transactions purging, if we allow users to enable/ disable CloudKit sync?

Due to privacy concern, I believe some users prefer their data not to sync with iCloud.

Hence, we plan to provide a switch option within the app, so that user can choose, whether to sync their data with iCloud.

Such feature can be achieved via the implementation suggested at https://developer.apple.com/forums/thread/118924?login=true

However, once user chooses to disable sync with iCloud, we should not perform purging on history tracking transactions.

Reason is that, if few months later/ few years later, user decides to turn on sync with iCloud again, lack of sufficient history tracking transactions, will cause sync with iCloud operation fail.

This is causing a dilemma. If we never clean the history tracking transactions, will it cause disk full issue?

If that is so, may I know, what is the correct way, to handle history tracking transactions purging, if we intent to provide CloutKit sync enable/ disable feature?

Thank you.

How should we handle history tracking transactions purging, if we allow users to enable/ disable CloudKit sync?
 
 
Q