SubaioManager

public final class SubaioManager

Singleton-class for managing global setup of subaio-views. Before creating views, SubaioManager.shared.configure should be invoked and SubaioManager.shared.language should be assigned.

The manager automatically maintains a valid token and requests new ones using the onTokenRequired callback whenever necessary.

  • Shared instance of the Subaio Manager.

    Declaration

    Swift

    public static let shared: SubaioManager
  • Access the current configuration.

    Declaration

    Swift

    public private(set) var configuration: SubaioConfiguration? {
      get
      }
  • Language to be used by all Subaio views as a BCP-47 string. Assigning language automatically updates all views and triggers a token refetch if configure has already been called. If it is set to nil or not set, views will never exit their loading-state.

    Declaration

    Swift

    public var language: String? { get set }
  • Configure Subaio Manager to use specified configuration object. Completion handler returns when Subaio is ready to be used.

    Declaration

    Swift

    public func configure(using configuration: SubaioConfiguration, completionHandler: @escaping (ConfigurationResult) -> Void)

    Parameters

    configuration

    The configuration to be used.

    completionHandler

    The completion handler returning either success or error.

  • Force a refresh of the token. This is necessary if the user changes authentication status (user logs out, user logs in, user is changed) to ensure that the token (or lack thereof) is correct.

    Only works after configure has been called and language has been set.

    Declaration

    Swift

    public func refreshToken()