SyncConfiguration

public struct SyncConfiguration

A SyncConfiguration represents configuration parameters for Realms intended to sync with a Realm Object Server.

  • The SyncUser who owns the Realm that this configuration should open.

    Declaration

    Swift

    public let user: SyncUser
  • The URL of the Realm on the Realm Object Server that this configuration should open.

    Warning

    The URL must be absolute (e.g. realms://example.com/~/foo), and cannot end with .realm, .realm.lock or .realm.management.

    Declaration

    Swift

    public let realmURL: URL
  • Whether the SSL certificate of the Realm Object Server should be validated.

    Declaration

    Swift

    public let enableSSLValidation: Bool
  • Whether this Realm should be opened in ‘partial synchronization’ mode. Partial synchronization mode means that no objects are synchronized from the remote Realm except those matching queries that the user explicitly specifies.

    -warning: Partial synchronization is a tech preview. Its APIs are subject to change.

    Declaration

    Swift

    public let isPartial: Bool
  • The prefix that is prepended to the path in the HTTP request that initiates a sync connection. The value specified must match with the server’s expectation. Changing the value of urlPrefix should be matched with a corresponding change of the server’s configuration. If no value is specified here then the default /realm-sync path is used.

    Declaration

    Swift

    public let urlPrefix: String?
  • Initialize a sync configuration with a user and a Realm URL.

    Additional settings can be optionally specified. Descriptions of these settings follow.

    enableSSLValidation is true by default. It can be disabled for debugging purposes.

    Warning

    The URL must be absolute (e.g. realms://example.com/~/foo), and cannot end with .realm, .realm.lock or .realm.management.

    Warning

    NEVER disable SSL validation for a system running in production.

    Declaration

    Swift

    public init(user: SyncUser, realmURL: URL, enableSSLValidation: Bool = true, isPartial: Bool = false, urlPrefix: String? = nil)
  • Return a Realm configuration for syncing with the default Realm of the currently logged-in sync user.

    Partial synchronization is enabled in the returned configuration.

    Requires

    There be exactly one logged-in SyncUser

    Declaration

    Swift

    public static func automatic() -> Realm.Configuration
  • Return a Realm configuration for syncing with the default Realm of the given sync user.

    Partial synchronization is enabled in the returned configuration.

    Declaration

    Swift

    public static func automatic(user: SyncUser) -> Realm.Configuration