Class

CloudKit

Use the CloudKit namespace to configure CloudKit JS, and to access app containers and global constants.

Declaration

interface CloudKit

Overview

Set up CloudKit JS by passing container and authentication information to the configure method. Also, specify whether to use the development or production environment. You’ll need the container ID and API token to configure CloudKit JS. (Use CloudKit Dashboard to create an API token, as described in Accessing CloudKit Using an API Token.) Some operations require users to enter their Apple ID credentials. Apple presents the sign-in dialog, but you can customize the position and theme of the sign-in and sign-out buttons.

After configuring CloudKit JS, use the container methods to get the app’s container objects (CloudKit.Container), and from the container objects, get the database objects (CloudKit.Database).

Topics

Configuring CloudKit JS

configure

Configures CloudKit JS.

Accessing Containers

getDefaultContainer

Returns the default container.

getContainer

Returns the container with the specified container ID.

getAllContainers

Returns all the containers that were configured.

Constants

CloudKit Build Version and Status

Constants describing the environment that stores the containers.

Environments

Constants to use when configuring the environment of containers.

Enumerations

CloudKit.AppleIDButtonTheme

Specifies the look of the Apple ID button.

CloudKit.DatabaseScope

Available database scopes.

CloudKit.QueryFilterComparator

The comparators you use to create queries.

CloudKit.ReferenceAction

The delete action for a reference object.

CloudKit.ShareParticipantAcceptanceStatus

The status of a participant accepting a share invitation.

CloudKit.ShareParticipantPermission

The status of a participant accepting a share invitation.

CloudKit.ShareParticipantType

Determines whether a participant can modify the list of participants of a shared record.

CloudKit.SubscriptionType

The type of subscription.

Properties

CKError

Property to access the error codes.

DatabaseScope

Property to access the enumeration.

Promise

Represents an operation that hasn't completed yet, but is expected in the future.

QueryFilterComparator

Property to access the enumeration.

ReferenceAction

Property to access the enumeration.

ShareParticipantAcceptanceStatus

Property to access the enumeration.

ShareParticipantPermission

Property to access the enumeration.

ShareParticipantType

Property to access the enumeration.

ShareRecordType

Property to access the class instance.

SubscriptionType

Property to access the enumeration.

Classes

CloudKit.CKError

A CloudKit.CKError object encapsulates an error that may occur when you use CloudKit JS. This includes CloudKit server errors and local errors.

CloudKit.Container

A CloudKit.Container object provides access to an app container, and through the app container, access to its databases. It also contains methods for authenticating and fetching users.

CloudKit.Database

A CloudKit.Database object represents a public or private database in an app container.

CloudKit.DatabaseChangesResponse

A CloudKit.DatabaseChangesResponse object encapsulates the results of fetching changed record zones in a database.

CloudKit.Notification

A CloudKit.Notification object represents a push notification that was sent to your app. Notifications are triggered by subscriptions that you save to the database. To subscribe to record changes and handle push notifications, see the saveSubscription method in CloudKit.Database.

CloudKit.QueryNotification

A CloudKit.QueryNotification object represents a push notification that was generated by a subscription object. A query notification is triggered by subscriptions where the subscriptionType key is query. Use a CloudKit.QueryNotification object to get information about the record that changed. To create query subscriptions and handle push notifications, see the saveSubscriptions method in CloudKit.Database.

CloudKit.QueryResponse

A CloudKit.QueryResponse object encapsulates the results of using a query to fetch records

CloudKit.RecordInfosResponse

A CloudKit.RecordInfosResponse object encapsulates the results of fetching information about records in general and shared records in particular.

CloudKit.RecordZoneChangesResponse

The CloudKit.RecordZoneChangesResponse object encapsulates the results of fetching changes to one or more record zones.

CloudKit.RecordZoneNotification

A CloudKit.RecordZoneNotification object represents a push notification that was caused by changes to the contents of a record zone. A zone notification is triggered by subscriptions where the subscriptionType key is zone. Use a CloudKit.RecordZoneNotification object to get information about the record that changed. To create zone subscriptions and handle push notifications, see the saveSubscriptions method in CloudKit.Database.

CloudKit.RecordZonesResponse

A CloudKit.RecordZonesResponse object encapsulates the results of database operations on a record zone.

CloudKit.RecordsBatchBuilder

A CloudKit.RecordsBatchBuilder object encapsulates the results of changes to multiple records in a single database operation.

CloudKit.RecordsResponse

A CloudKit.RecordsResponse object encapsulates the results of fetching records.

CloudKit.Response

The CloudKit.Response class is an abstract superclass for subclasses that encapsulate the response from server requests. Don’t create instances of this class. Instances of subclasses are returned by methods in the CloudKit.Container and CloudKit.Database classes. Most of these methods return a Promise object that resolves to a subclass of CloudKit.Response if the operation is successful.

CloudKit.ShareRecordType

Display information about the record type of a shared record.

CloudKit.SubscriptionsResponse

A CloudKit.SubscriptionsResponse object encapsulates the results of database operations on subscriptions.

CloudKit.UserIdentitiesResponse

A CloudKit.UserIdentitiesResponse object encapsulates the results of fetching user identities.

Structures

CloudKit.CloudKitConfig

Dictionary used to configure the CloudKit environment.

CloudKit.ContainerConfig

A configuration for a container.

CloudKit.NameComponents

The parts of the user’s name.

CloudKit.NotificationInfo

Information about a notification.

CloudKit.Query

Search parameters to use when fetching records from the database.

CloudKit.Record

A record in the database.

CloudKit.RecordField

A field value of a record.

CloudKit.RecordInfo

Encapsulates the results of fetching information about a record.

CloudKit.RecordZone

Represents a record zone.

CloudKit.RecordZoneChanges

Represents the changes in a record zone.

CloudKit.RecordZoneChangesOptions

Options about fetching changes in a record zone.

CloudKit.Share

Represents a shared record.

CloudKit.ShareParticipant

Represents a user who accepted a shared record.

CloudKit.SharingUIResult

Represents the results of sharing a record with other users.

CloudKit.Subscription

A subscription, which is a persistent query on the server that tracks the creation, deletion, and modification of records.

CloudKit.UserIdentity

Information to identify a user.

CloudKit.UserLookupInfo

Information that can be used to fetch a user.

CloudKit.ZoneID

An identifier for a zone, which is an area in a database for organizing related records.