CloudKit is introduced in 2014. It’s a cloud solution from Apple to easily integrate iCloud with your app.
For AltConf in June 2018, I gave a talk about starting with CloudKit, which gave an introduction on how to setup CloudKit for your apps, what the benefits are and how developers can query and store data to iCloud using CloudKit.
What is CloudKit?
CloudKit is the framework that powers iCloud on all Apple platforms. It’s feature-rich API to store and query your own custom data in iCloud. It’s available for iOS, tvOS, watchOS and macOS.
Most users are already signed in with an iCloud account before they open your app, which allows you in most cases to directly start your service without any login setup at the start. This is a big benefit if you want to support tvOS, because you don’t have to think about complex or UX-unfriendly login interfaces.
There are three type of databases that are supported by CloudKit. The first one, is the private database. This is a private database for your user, where you can store private data about the user, like private notes, images and more.
There is also a shared database, which is used to store shared items. In this database, you can save objects which can be changes by multiple iCloud users. Apple did integrate this for example in Pages, Keynote or Notes app.
There is also a public database, which can be used to store all public data which can be read by all users.
In development, when you run your app through Xcode on a simulator, you need to enter iCloud credentials to read records in the public database. In production, the default permissions allow non-authenticated users to read records in the public database but do not allow them to write records.
- Easy to use in development
- Syncing data between Apple devices automatically
- No need to worry about a secure backend
- Sharing between Apple devices
- Data in a private database is not visible for the developer
- No need to login for the user or give permission to allow you to use CloudKit
- Only available for Apple devices
Watch the talk!
The talk is recored by AltConf, but is missing the slides and the voice is hard to hear. You can download the slides from here.