SwiftData + CloudKit integration uses NSPersistentCloutKitContainer under the hood, and it is intentional that the framework deletes the local data when the user turns off iCloud for the app in Settings. The behavior is discussed in this post. Feel free to follow up here with further questions, if any. Best, —— Ziqiao Chen Worldwide Developer Relations.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: