One Logo Pool Ball
CloudKit · IOS API REFERENCE

CKSyncEngine.Configuration

struct · iOS 17.0+ · SDK 27.1

struct Configuration

A type that configures the attributes and behavior of a sync engine.

Members (12)

get · iOS 17.0+

description

TypeScript
get description(): string
Swift declaration
var description: String { get }

A textual description of the configuration that's suitable for logging.

get · iOS 17.0+

subscriptionID

TypeScript
get subscriptionID(): (string) | null
Swift declaration
var subscriptionID: CKSubscription.ID?

The subscription identifier for the associated database. By default, a sync engine attempts to discover an existing subscription for the synced database. If one isn't found, the engine creates an internal ``CKDatabaseSubscription`` and uses that to receive notifications about remote record changes. If you require the sync engine to use a specific database subscription, assign that subscription's identifier to this property. Doing so enables your app to be backwards compatible if you're migrating to ``CKSyncEngine-5sie5`` from a custom CloudKit sync implementation. The default value is `nil`.

set · iOS 17.0+

subscriptionID

TypeScript
set subscriptionID(value: (string) | null)
Swift declaration
var subscriptionID: CKSubscription.ID?

The subscription identifier for the associated database. By default, a sync engine attempts to discover an existing subscription for the synced database. If one isn't found, the engine creates an internal ``CKDatabaseSubscription`` and uses that to receive notifications about remote record changes. If you require the sync engine to use a specific database subscription, assign that subscription's identifier to this property. Doing so enables your app to be backwards compatible if you're migrating to ``CKSyncEngine-5sie5`` from a custom CloudKit sync implementation. The default value is `nil`.

get · iOS 17.0+

automaticallySync

TypeScript
get automaticallySync(): boolean
Swift declaration
var automaticallySync: Bool

A Boolean value that determines whether the engine syncs automatically. By default, the sync engine uses the system scheduler to automatically schedule both send and fetch operations. If an operation fails due to a recoverable error, such as a network failure or when the server is enforcing request limits, the engine reschedules those operations as necessary. Unless you have a specific need, prefer to use the default behavior in your app. If you set this property's value to `false`, use ``CKSyncEngine-5sie5/fetchChanges(_:)`` and ``CKSyncEngine-5sie5/sendChanges(_:)`` to invoke immediate sync operations, allowing for more control over when your app syncs its records. For example, you may want to sync at a specific time of day or deterministically simulate certain conditions in your unit tests. The default value is `true`.

set · iOS 17.0+

automaticallySync

TypeScript
set automaticallySync(value: boolean)
Swift declaration
var automaticallySync: Bool

A Boolean value that determines whether the engine syncs automatically. By default, the sync engine uses the system scheduler to automatically schedule both send and fetch operations. If an operation fails due to a recoverable error, such as a network failure or when the server is enforcing request limits, the engine reschedules those operations as necessary. Unless you have a specific need, prefer to use the default behavior in your app. If you set this property's value to `false`, use ``CKSyncEngine-5sie5/fetchChanges(_:)`` and ``CKSyncEngine-5sie5/sendChanges(_:)`` to invoke immediate sync operations, allowing for more control over when your app syncs its records. For example, you may want to sync at a specific time of day or deterministically simulate certain conditions in your unit tests. The default value is `true`.

get · iOS 17.0+

stateSerialization

TypeScript
get stateSerialization(): (CKSyncEngine_State_Serialization) | null
Swift declaration
var stateSerialization: CKSyncEngine.State.Serialization?

The sync engine's serialized state. This property returns the value you specify for the initializer's `stateSerialization` parameter. If you choose to set this property after initialization, assign the state from the most recent ``CKSyncEngine-5sie5/Event/stateUpdate(_:)`` event handled by your delegate. However, if this is the first initialization of the associated sync engine, specify `nil` instead. The default value is `nil`.

set · iOS 17.0+

stateSerialization

TypeScript
set stateSerialization(value: (CKSyncEngine_State_Serialization) | null)
Swift declaration
var stateSerialization: CKSyncEngine.State.Serialization?

The sync engine's serialized state. This property returns the value you specify for the initializer's `stateSerialization` parameter. If you choose to set this property after initialization, assign the state from the most recent ``CKSyncEngine-5sie5/Event/stateUpdate(_:)`` event handled by your delegate. However, if this is the first initialization of the associated sync engine, specify `nil` instead. The default value is `nil`.

init · iOS 17.0+

init

TypeScript
static init(database: CKDatabase, stateSerialization: (CKSyncEngine_State_Serialization) | null, delegate: SDKHandle): CKSyncEngine_Configuration
Swift declaration
init(database: CKDatabase, stateSerialization: CKSyncEngine.State.Serialization?, delegate: any CKSyncEngineDelegate)

Creates a configuration for the specified database and serialized state. - Parameters: - database: The database to sync — either a person's private database or their shared database. - stateSerialization: If this is the first initialization of the associated sync engine, specify `nil`; otherwise, specify the state from the most recent ``CKSyncEngine-5sie5/Event/stateUpdate(_:)`` event that your delegate handled. - delegate: The object that provides the records to sync and handles any related events.

get · iOS 17.0+

database

TypeScript
get database(): CKDatabase
Swift declaration
var database: CKDatabase

The associated database. Multiple sync engines can run in the same process, each targeting a different database. For example, you may use one sync engine for a person's private database and another for their shared database. - Important: When using CloudKit's production environment, don't create multiple sync engines that target the same database. You can, however, do this in the development environment to help testing — for example, to simulate multiple devices syncing back and forth.

set · iOS 17.0+

database

TypeScript
set database(value: CKDatabase)
Swift declaration
var database: CKDatabase

The associated database. Multiple sync engines can run in the same process, each targeting a different database. For example, you may use one sync engine for a person's private database and another for their shared database. - Important: When using CloudKit's production environment, don't create multiple sync engines that target the same database. You can, however, do this in the development environment to help testing — for example, to simulate multiple devices syncing back and forth.

get · iOS 17.0+

delegate

TypeScript
get delegate(): SDKHandle
Swift declaration
var delegate: any CKSyncEngineDelegate

The object that provides the records to sync and handles any related events.

set · iOS 17.0+

delegate

TypeScript
set delegate(value: SDKHandle)
Swift declaration
var delegate: any CKSyncEngineDelegate

The object that provides the records to sync and handles any related events.

Skipped declarations

No declarations were skipped in this snapshot.

All CloudKit types →