CloudKit is Apple’s remote data storage service. Based on iCloud, it provides a low-cost option to store and share app data. By Jessy Catterwaul.

5 (2) · 1 Review

Download materials
Save for later

Who is this for?

This course is for iOS developers who have either not yet dived into the CloudKit framework, or who have not seen its latest incarnation. The new CloudKit console, and even newer asynchronous APIs, will be covered.

Covered concepts

  • CKContainer
  • CKRecord
  • CKQuery
  • Entitlements
  • Databases
  • CloudKit Console
  • async/await

Part 0: CloudKit

Toggle description

There are three main reasons why you should choose CloudKit over other commercial BaaS offerings, or even your own server: simplicity, trust, and cost.

Toggle description

To create the CKContainer that will hold all of the app’s records, you first need to enable the iCloud entitlements for your app.

Toggle description

The CloudKit Console is the web interface that allows you to manage your database in a visual way.

Toggle description

A Record Type is a set of fields that defines an individual CKRecord. You can think of it like a Swift class.

Toggle description

To select records from a database, you’ll use CKQuery. A CKQuery describes how to find all records of a specific type that match certain criteria.

Toggle description

With your query object ready to go, you’ll need to use a CloudKit database to perform it.

Toggle description

An asset is binary data, such as an image, that you associate with a record.

Toggle description

You can create a relationship between different record types in CloudKit. You’ll use a one-to-many relationship.

Initializing arrays based on CKReferences is similar to working with other CKRecords. But it’s somewhat simpler, given that the reference provides information.

Conclusion 2:05
Toggle description

That’s all for this introduction to CloudKit. We’ll briefly review some things to consider when working with CloudKit as well as where to go from here.