RLMAsyncOpenTask

Objective-C


@interface RLMAsyncOpenTask : NSObject

Swift

@_nonSendable(_assumed) class RLMAsyncOpenTask : NSObject, @unchecked Sendable

A task object which can be used to observe or cancel an async open.

When a synchronized Realm is opened asynchronously, the latest state of the Realm is downloaded from the server before the completion callback is invoked. This task object can be used to observe the state of the download or to cancel it. This should be used instead of trying to observe the download via the sync session as the sync session itself is created asynchronously, and may not exist yet when -[RLMRealm asyncOpenWithConfiguration:completion:] returns.

  • Cancel the asynchronous open.

    Any download in progress will be cancelled, and the completion block for this async open will never be called. If multiple async opens on the same Realm are happening concurrently, all other opens will fail with the error “operation cancelled”.

    Declaration

    Objective-C

    - (void)cancel;

    Swift

    func cancel()