Class

NSPersistentCloudKitContainer

A container that encapsulates the Core Data stack in your app and mirrors select persistent stores to a CloudKit private database.

Declaration

class NSPersistentCloudKitContainer : NSPersistentContainer

Overview

NSPersistentCloudKitContainer is a subclass of NSPersistentContainer capable of managing both CloudKit-backed and non-cloud stores.

By default, NSPersistentCloudKitContainer contains a single store description, assigned to the first CloudKit container identifier in an application’s entitlements. Use NSPersistentCloudKitContainerOptions to customize this behavior or create additional store descriptions backed by different containers.

For more information about setting up multiple stores see Setting Up Core Data with CloudKit.

Topics

Accessing CloudKit Records

func record(for: NSManagedObjectID) -> CKRecord?

Gets the CloudKit record that corresponds to the given managed object.

func records(for: [NSManagedObjectID]) -> [NSManagedObjectID : CKRecord]

Gets the CloudKit records that correspond to the given managed objects.

func recordID(for: NSManagedObjectID) -> CKRecordID?

Gets the ID of the CloudKit record that corresponds to the given managed object.

func recordIDs(for: [NSManagedObjectID]) -> [NSManagedObjectID : CKRecordID]

Gets the IDs of the CloudKit records that correspond to the given managed objects.

Relationships

Conforms To

See Also

CloudKit Mirroring

Mirroring a Core Data Store with CloudKit

Back user interfaces with a local replica of a CloudKit private database.

Synchronizing a Local Store to the Cloud

Share data between a user’s devices using Core Data with CloudKit.

class NSPersistentCloudKitContainerOptions

An object that customizes how a store description aligns with a CloudKit database.