SyncUser

public typealias SyncUser = RLMSyncUser
  • Given credentials and a server URL, log in a user and asynchronously return a SyncUser object which can be used to open Realms and retrieve SyncSessions.

    Declaration

    Swift

    public static func logIn(with credentials: SyncCredentials,
                                 server authServerURL: URL,
                                 timeout: TimeInterval = 30,
                                 onCompletion completion: @escaping UserCompletionBlock)
  • all

    A dictionary of all valid, logged-in user identities corresponding to their SyncUser objects.

    Declaration

    Swift

    public static var all: [String: SyncUser]
  • The logged-in user. nil if none exists. Only use this property if your application expects no more than one logged-in user at any given time.

    Warning

    Throws an Objective-C exception if more than one logged-in user exists.

    Declaration

    Swift

    public static var current: SyncUser?
  • An optional error handler which can be set to notify the host application when the user encounters an error.

    Note

    Check for .invalidAccessToken to see if the user has been remotely logged out because its refresh token expired, or because the third party authentication service providing the user’s identity has logged the user out.

    Warning

    Regardless of whether an error handler is defined, certain user errors will automatically cause the user to enter the logged out state.

    Declaration

    Swift

    @nonobjc public var errorHandler: ((SyncUser, SyncAuthError) -> Void)?
  • Returns an instance of the Management Realm owned by the user.

    This Realm can be used to control access permissions for Realms managed by the user. This includes granting other users access to Realms.

    Declaration

    Swift

    public func managementRealm() throws -> Realm
  • Returns an instance of the Permission Realm owned by the user.

    This read-only Realm contains SyncPermission objects reflecting the synchronized Realms and permission details this user has access to.

    Declaration

    Swift

    public func permissionRealm() throws -> Realm