SyncSession

public typealias SyncSession = RLMSyncSession
  • 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 more

    Declaration

    Swift

    public enum ProgressDirection
  • 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 more

    Declaration

    Swift

    public enum ProgressMode
  • A token corresponding to a progress notification block.

    Call stop() on the token to stop notifications. If the notification block has already been automatically stopped, calling stop() does nothing. stop() should be called before the token is destroyed.

    Declaration

    Swift

    public typealias ProgressNotificationToken = RLMProgressNotificationToken
  • A struct encapsulating progress information, as well as useful helper methods.

    See more

    Declaration

    Swift

    public struct Progress
  • 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 stop() 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 forCurrentlyOutstandingWork mode 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

    public func addProgressNotification(for direction: ProgressDirection,
                                            mode: ProgressMode,
                                            block: @escaping (Progress) -> Void) -> ProgressNotificationToken?

    Parameters

    direction

    The transfer direction (upload or download) to track in this progress notification block.

    mode

    The desired behavior of this progress notification block.

    block

    The 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.