Sync Data Between Devices - Swift SDK
Atlas Device Sync automatically synchronizes data between client applications and an App Services backend. When a client device is online, Sync asynchronously synchronizes data in a background thread between the device and your backend App.
Tip
See also:
Flexible Sync
New in version 10.22.0.
When you select Flexible Sync for your backend App configuration, your client implementation must include subscriptions to queries on queryable fields. Flexible Sync works by synchronizing data that matches query subscriptions you maintain in the client application.
A subscription set contains a set of queries. Flexible Sync returns documents matching those queries, where the user has the appropriate permissions to read and/or read and write the documents. If documents match the query, but the client does not have the permission to read or write them, they do not sync to the client application.
You can form queries using Realm Query Language.
Note
Flexible Sync does not support all the query operators available in Realm Query Language and the SDK's query engine. See Flexible Sync RQL Limitations for details.
Subscription sets are based on a specific type of Realm object. You might have multiple subscriptions if you have many types of Realm objects.
To use Flexible Sync in your client application, open a synced realm with a Flexible Sync configuration. Then, manage subscriptions to determine which documents to sync.
Tip
Device Sync supports two Sync Modes: Flexible Sync, and the older Partition-Based Sync. If your App Services backend uses Partition-Based Sync, refer to Partition-Based Sync - Swift SDK.
We recommend new apps use Flexible Sync.
Sync Connection and Timeout Behaviors
In Realm Swift SDK version 10.41.0 and later, you can specify:
Sync timeout behaviors
Whether opening more than one synced realm opens more than one connection to the server
You can specify these settings on the App client configuration.
Supported Operating Systems
The Realm Swift SDK supports connecting to an Atlas App Services App for a range of Apple operating systems depending on the Xcode version and Realm Swift SDK version. Connecting to an App Services App enables:
Authentication and User Management
Calling an Atlas Function
Querying a MongoDB Atlas Data Source
Device Sync
For current information about supported operating systems, refer to OS Support.
At this time, the Realm Swift SDK does not support connecting to an App Services App from watchOS.