App

public extension App
extension App: ObservableObject
  • Login to a user for the Realm app.

    Declaration

    Swift

    @preconcurrency
    func login(credentials: Credentials, _ completion: @escaping @Sendable (Result<User, Error>) -> Void)

    Parameters

    credentials

    The credentials identifying the user.

    completion

    A callback invoked after completion. Will return Result.success(User) or Result.failure(Error).

  • Login to a user for the Realm app.

    Declaration

    Swift

    @available(macOS 10.15, watchOS 6.0, iOS 13.0, tvOS 13.0, *)
    func login(credentials: Credentials) -> Future<User, Error>

    Parameters

    credentials

    The credentials identifying the user.

    Return Value

    A publisher that eventually return User or Error.

  • login(credentials:) Asynchronous

    Login to a user for the Realm app.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
    func login(credentials: Credentials) async throws -> User

    Parameters

    credentials

    The credentials identifying the user.

  • Sets the ASAuthorizationControllerDelegate to be handled by App

    Usage:

    let app = App(id: "my-app-id")
    let appleIDProvider = ASAuthorizationAppleIDProvider()
    let request = appleIDProvider.createRequest()
    request.requestedScopes = [.fullName, .email]
    
    let authorizationController = ASAuthorizationController(authorizationRequests: [request])
    app.setASAuthorizationControllerDelegate(controller: authorizationController)
    authorizationController.presentationContextProvider = self
    authorizationController.performRequests()
    

    Declaration

    Swift

    public func setASAuthorizationControllerDelegate(for controller: ASAuthorizationController)

    Parameters

    controller

    The ASAuthorizationController in which you want App to consume its delegate.

  • A publisher that emits Void each time the app changes.

    Despite the name, this actually emits after the app has changed.

    Declaration

    Swift

    public var objectWillChange: AppPublisher { get }