I’m currently working on a watch only app and I’m trying to understand how best to persist my model data for the user’s data. I plan to release for watchOS 7. I plan to use SwiftUI. I’m still trying to decide if I continue using a WatchKit extension project structure (created from Xcode 11) or start again with a 100% SwiftUI watch only project using Xcode 12. Does that affect selection of a data persistance approach?
I’ve used CloudKit for data persistance in my iOS app. I guess I could do this again For my watchOS app, or maybe in conjunction with Core Data, but how do I assess the various options? What are the best practices in choosing an approach to persist model data for a watch app? My model data won’t be too complex. Just an array of items, each item consisting of a string and image.
Any recommendations are welcome.
I’ve used CloudKit for data persistance in my iOS app. I guess I could do this again For my watchOS app, or maybe in conjunction with Core Data, but how do I assess the various options? What are the best practices in choosing an approach to persist model data for a watch app? My model data won’t be too complex. Just an array of items, each item consisting of a string and image.
Any recommendations are welcome.
This sounds like a good use case for Core Data, you can use it with any app architecture. CloudKit is not a solution for local persistence, it is basically a transport technology that you can use to store data in iCloud, synchronize data between a user's devices, or share content with other users.
If you want your data to stay on the watch, NSPersistentContainer is your best option. If you want to sync data with your iOS app, use NSPersistentCloudKitContainer. The latter makes use of CloudKit to automatically mirror all local changes to iCloud and other devices.
If you want your data to stay on the watch, NSPersistentContainer is your best option. If you want to sync data with your iOS app, use NSPersistentCloudKitContainer. The latter makes use of CloudKit to automatically mirror all local changes to iCloud and other devices.