Lesson 25
Introduction to CloudKit
In Lesson 24, you learned how to create an app that could store documents on iCloud and access these documents across different devices. In this lesson, you learn about CloudKit, which is a set of APIs that allow you to move structured data between your app and iCloud. Whereas iCloud document storage operates on files, CloudKit operates on dictionaries of key-value pairs called records. To use a relational database analogy, a record is similar to a row in a table.
CloudKit also allows relationships between records. You may be tempted to use CloudKit to replace CoreData in your application, but these two technologies complement each other and are not meant to replace each other. CoreData is concerned with storing model objects locally; CloudKit is concerned with moving some of the data in these model objects to iCloud so that they can be accessed by other instances of your application.
When using CloudKit, your application decides when to move data to and from iCloud. The process is not automatic. It is possible to configure iCloud to inform your application when changes occur; your application will still need to fetch those changes. In this lesson, you will look at some of the key concepts involved in building iOS applications with CloudKit.
Containers, Databases, and Records
Data in iCloud is organized into containers. Containers are represented by instances of CKContainer
objects and every iCloud enabled app has at least one container ...
Get Swift iOS 24-Hour Trainer now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.