Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Swift: Local persistence with CloudKit

I'm using CloudKit to fetch/store data but would also like to have a local persistence layer. Does CloudKit offer any kind of local storage capabilities? Or should I use NSUserDefaults (NSKeyedArchiver/NSKeyedUnarchiver)?

like image 874
colindunn Avatar asked Mar 17 '15 19:03

colindunn


People also ask

How do I save to CloudKit?

Click your app name at the top of the Navigator and choose the Capabilities tab at the top. After that, find the iCloud option in the list of capabilities and turn the switch on. Make sure CloudKit and Use default container are selected. Once those three things are done your app is ready to use CloudKit!

Is CloudKit like firebase?

It's a common misconception that Firebase and CloudKit are fairly interchangeable. Whilst they are both serverless storage solutions, you should take their features into careful consideration before deciding to use one or the other.

What is CloudKit mirroring?

Configuring CloudKit MirroringSynchronize objects between devices, and handle store changes in the user interface. Reading CloudKit Records for Core Data. Access CloudKit records created from Core Data managed objects.

What is Core Data host in CloudKit?

Core Data owns the record ID for all of the objects that it creates in CloudKit. And, for each one, we will generate a simple UUID to use as its record name. When the Record Name is combined with a zone identifier you get a CKRecord ID. At the bottom, you'll see how Core Data manages type information.


1 Answers

There is no mechanism for cashing data locally in CloudKit, you have to do that yourself. I can suggest you to take a look at EVCloudKitDao which is a convenience library for CloudKit that has support for local cashing to a file.

like image 126
Edwin Vermeer Avatar answered Sep 21 '22 05:09

Edwin Vermeer