SyncSession
public extension SyncSession
-
The current state of the session represented by a session object.
See
RLMSyncSessionStateDeclaration
Swift
typealias State = RLMSyncSessionState -
The current state of a sync session’s connection.
See
RLMSyncConnectionStateDeclaration
Swift
typealias ConnectionState = RLMSyncConnectionState -
The transfer direction (upload or download) tracked by a given progress notification block.
Progress notification blocks can be registered on sessions if your app wishes to be informed how many bytes have been uploaded or downloaded, for example to show progress indicator UIs.
See moreDeclaration
Swift
enum ProgressDirection : Sendable -
The desired behavior of a progress notification block.
Progress notification blocks can be registered on sessions if your app wishes to be informed how many bytes have been uploaded or downloaded, for example to show progress indicator UIs.
See moreDeclaration
Swift
enum ProgressMode : Sendable -
A token corresponding to a progress notification block.
Call
invalidate()on the token to stop notifications. If the notification block has already been automatically stopped, callinginvalidate()does nothing.invalidate()should be called before the token is destroyed.Declaration
Swift
typealias ProgressNotificationToken = RLMProgressNotificationToken -
A struct encapsulating progress information.
See moreDeclaration
Swift
struct Progress : Sendable -
Register a progress notification block.
If the session has already received progress information from the synchronization subsystem, the block will be called immediately. Otherwise, it will be called as soon as progress information becomes available.
Multiple blocks can be registered with the same session at once. Each block will be invoked on a side queue devoted to progress notifications.
The token returned by this method must be retained as long as progress notifications are desired, and the
invalidate()method should be called on it when notifications are no longer needed and before the token is destroyed.If no token is returned, the notification block will never be called again. There are a number of reasons this might be true. If the session has previously experienced a fatal error it will not accept progress notification blocks. If the block was configured in the
forCurrentlyOutstandingWorkmode but there is no additional progress to report (for example, the number of transferrable bytes and transferred bytes are equal), the block will not be called again.Declaration
Swift
@preconcurrency func addProgressNotification(for direction: ProgressDirection, mode: ProgressMode, block: @Sendable @escaping (Progress) -> Void) -> ProgressNotificationToken?Parameters
directionThe transfer direction (upload or download) to track in this progress notification block.
modeThe desired behavior of this progress notification block.
blockThe block to invoke when notifications are available.
Return Value
A token which must be held for as long as you want notifications to be delivered.
-
Wait for pending uploads or downloads to complete or the session to expire, and dispatch the callback onto the specified queue.
Warning
This method is not meant to be used except in special cases, notably for testing.
Declaration
Swift
func wait(for direction: ProgressDirection, queue: DispatchQueue? = nil, block: @Sendable @escaping (Error?) -> Void)Parameters
directionThe transfer direction (upload or download) to wait for.
queueThe queue to dispatch the callback onto.
blockThe block to invoke when waiting is complete.
-
wait(for:Asynchronous) Wait for pending uploads or downloads to complete or the session to expire.
Warning
This method is not meant to be used except in special cases, notably for testing.
Declaration
Swift
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) func wait(for direction: ProgressDirection) async throwsParameters
directionThe transfer direction (upload or download) to wait for.
View on GitHub
Install in Dash