Sync
public class Sync
ObjectBox Sync makes data available on other devices (check the link for details).
This class is the point of entry for Sync, e.g. create a sync client using Sync.makeClient(store, urlString).
-
Checks if this library comes with a sync client. If you do not have a sync enabled version yet, please visit https://objectbox.io/sync for more details.
Declaration
Swift
public static func isAvailable() -> BoolReturn Value
true if calling makeClient() is possible (without throwing)
-
Creates a sync client associated with the given store and sync server with the given URL. This does not initiate any connection attempts yet: call start() to do so. Before start(), you can still configure some aspects of the sync client, e.g. its “request update” mode.
Note: while you may not interact with SyncClient directly after start(), you need to hold on to the object: by keeping a reference you ensure the SyncClient is not destroyed and thus synchronization can keep running in the background. If you must, you can use Swift’s withExtendedLifetime() for that.
Pass either a
urlor aurlString(auto-converted toURL).To configure Sync filter variables, pass variable names mapped to their value to
filterVariables.Sync client filter variables can be used in server-side Sync filters to filter out objects that do not match the filter.
To for example use self-signed certificates in a local development environment or custom CAs, pass certificate paths referring to the local file system to
certificatePaths.Throws
ObjectBoxError.syncif sync is unavailable in this version of the library or no valid URL was provided.Declaration
Swift
public static func makeClient( store: Store, url: URL? = nil, urlString: String? = nil, credentials: SyncCredentials? = nil, filterVariables: [String: String]? = nil, certificatePaths: [String] = [] ) throws -> SyncClient -
Like
makeClient(store:url:urlString:credentials:)-6rikk, but accepts multiple credentials.Declaration
Swift
public static func makeClient( store: Store, url: URL? = nil, urlString: String? = nil, credentials: [SyncCredentials], filterVariables: [String: String]? = nil, certificatePaths: [String] = [] ) throws -> SyncClient
View on GitHub
Install in Dash
Sync Class Reference