Local Data Storage Best Practices

I’m getting started on my app and I’m interested in best practices for data storage. To mitigate regulatory issues (it’s a medical app), the data collected in the app will only be stored on the phone. I’ve been doing some Googling but it’s unclear to me whether CoreData will automatically be uploaded to the cloud. I’ve also considered saving the data in a JSON file on the phone (not sure how to do that yet, still investigating). Using JSON would necessitate a serialization operation each time the data is changed and I don’t have a good handle on the amount to data that will be saved yet so that option is still up in the air (that’s why we use a data model, right :wink: ). So, I guess the questions are: Is CoreData uploaded to the cloud? If so, is there a way to disable that? Is CoreData encrypted? Same three questions for JSON files on the phone. Thanks!


Core Data is only uploaded if you select Cloudkit when creating the project. The cloudKit check box changes NSPersistentContainer to NSPersistentCloudKitContainer. That is all I can see at any rate.

I believe you can also encrypt the sqlite file, but I have not explored that option since I don’t need it.


1 Like