Daniel Lyons' Notes

CloudKit - Intro, Pricing, Terms, & Definitions

Description

Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.

My Notes

0:00 - What is CloudKit

  • Introduced in 2014.
  • Apple's first-party backend service, comparable to Firebase.
  • Available across all Apple platforms: macOS, iOS, watchOS.
  • Powers many native Apple applications like Notes, Photos, Apple News, and the WWDC app.
  • Proven scalability, used by millions of users without issues.

1:08 - CloudKit Pricing

  • Predominantly free, offering generous data transfer and storage.
  • Scales with your app's user base, providing more free storage and transfer as user numbers grow.
  • Designed to be free, with limits to prevent abuse.
  • Overage charges apply if limits are exceeded (e.g., $0.03/GB for asset storage), which is typically a good problem to have, indicating app success.
  • Data stored in a user's private database counts against their personal iCloud storage quota, not the app developer's.

3:09 - Pros of CloudKit

  • Automatic Authentication: No need to build login screens; users are automatically authenticated via their iCloud account.
  • Data Syncing: Facilitates seamless data synchronization across all a user's Apple devices.
  • Apple's First-Party Support: Ensures long-term support and integration, as major Apple apps are built on it. No need for heavy third-party SDKs or package managers.
  • Sharing: Simplifies the implementation of sharing and collaboration features (e.g., shared notes or photo albums).
  • Privacy: Provides strong privacy guarantees, especially for private databases, where developers cannot access user data.

5:14 - Privacy

  • Users have a private database for their data.
  • Even as a developer, you cannot access or view the contents of a user's private database.
  • Data in the private database counts against the user's personal iCloud storage, not the developer's app quota.

5:54 - Cons of CloudKit

  • Apple Only: CloudKit is exclusively for Apple platforms, making it unsuitable for cross-platform applications targeting Android users. (Note: CloudKit JS exists for web access but has limitations).
  • Requires Apple Developer Account: Development with CloudKit necessitates an Apple Developer Program membership, which costs $99/year.
  • Cannot Transfer Apps: An app integrated with CloudKit cannot be easily transferred or sold to another developer account. A workaround involves creating a dedicated developer account for the app from the outset if acquisition is a future possibility.

8:52 - Why I chose CloudKit for Dub Dub Grub

  • Needed a Backend as a Service (BaaS) to manage custom data.
  • The target audience is iOS developers attending WWDC, eliminating the need for Android support.
  • The automatic sign-on feature significantly simplifies user management by removing the need for login screens and password recovery flows.
  • Preference for using first-party Apple frameworks and services.

10:14 - Terms & Definitions Intro

10:23 - Containers

  • Definition: An app-specific top-level organizational unit within CloudKit, acting as the overarching container for your application's data.
  • Examples: Notes, Photos, and the Dub Dub Grub app each have their own distinct CloudKit containers.
  • Significance: When setting up CloudKit in Xcode, you explicitly create and link your app to a container.

10:48 - Public, Private, and Shared Databases

  • Within each container, there are three primary types of databases:
    • Public Database:
      • Definition: Stores data that is accessible and visible to all users of the app.
      • Use Cases: News articles in Apple News, WWDC videos, or public locations in Dub Dub Grub.
    • Private Database:
      • Definition: Stores user-specific data that is private to the individual user and is not accessible by the app developer.
      • Characteristics: Data stored here counts against the user's personal iCloud storage quota.
      • Use Cases: Personal notes in the Notes app, or a user's private photos.
    • Shared Database:
      • Definition: Stores data that is shared among specific groups of users, enabling collaboration.
      • Use Cases: Collaborating on a note or sharing a photo album with other iCloud users.

12:44 - CKRecords

  • CKRecord
  • Record Type:
    • Definition: A schema or blueprint that defines the structure and properties of a specific type of data in your app, similar to a model object.
    • Example: DDGLocation could be a record type with properties like name, address, and description.
  • Record:
    • Definition: An individual instance of a record type, representing an actual data entry.
    • Example: "Chipotle", "Original Joe's", or "Peggy Sue's 50s Diner" would be individual records of the DDGLocation record type.
  • Functionality: Records are the primary units of data that are fetched, saved, and updated when interacting with CloudKit databases. They reside within the public, private, or shared databases depending on their intended use.

13:49 - CKReference

  • CKReference
  • Definition: A mechanism to link two records together, effectively creating a pointer from one record to another. It's one of the data types that can be attached to a record, alongside strings, arrays, or assets.
  • Use Case: In Dub Dub Grub, a DDGProfile (representing a user) could have a CKReference to a DDGLocation to indicate that the user is "checked into" that specific location.

14:36 - CKOperation

  • Definition: The core component for interacting with CloudKit; it defines how your app communicates with the CloudKit backend to perform actions like fetching, querying, saving, and deleting data.
  • Capabilities: CKOperation provides the full power of NSOperation, allowing for advanced features such as:
    • Controlling quality of service for operations.
    • Performing batch fetches and batch updates of records.
    • Fetching partial records (e.g., retrieving only a specific field like a user's first name, rather than the entire record object).
  • Significance: CKOperation is the fundamental "workhorse" for most complex CloudKit interactions.

15:37 - Convenience API

  • Definition: A higher-level API built on top of CKOperation that simplifies common CloudKit tasks with less boilerplate code.
  • Limitations: Generally limited to performing operations on one record at a time.
  • Use Case: Ideal for simple, single-record operations, such as saving a user's profile after they enter their information.
  • Relationship to CKOperation: The Convenience API handles many routine tasks, but CKOperation is used when more control, batching, or advanced features like partial record fetching are required.

17:22 - Course Info & Discount

Transcript

CloudKit - Intro, Pricing, Terms, & Definitions
Interactive graph
On this page
Description
My Notes
0:00 - What is CloudKit
1:08 - CloudKit Pricing
3:09 - Pros of CloudKit
5:14 - Privacy
5:54 - Cons of CloudKit
8:52 - Why I chose CloudKit for Dub Dub Grub
10:14 - Terms & Definitions Intro
10:23 - Containers
10:48 - Public, Private, and Shared Databases
12:44 - CKRecords
13:49 - CKReference
14:36 - CKOperation
15:37 - Convenience API
17:22 - Course Info & Discount
Transcript