OnboardingController

public class OnboardingController : OnboardingControlling

Onboards or restores an OnboardingFlow based on the response of the given OnboardingIDManaging implementation.

  • OnboardingFlowProviding that returns appropriate OnboardingFlow

    Declaration

    Swift

    public let flowProvider: OnboardingFlowProviding
  • Provides information about what type of flow should begin when openFlow is being called and also manages the OnboardingID

    Declaration

    Swift

    public let onboardingIDManager: OnboardingIDManaging
  • Delegate that tracks the progress of the given flow

    Declaration

    Swift

    public weak var delegate: OnboardingControllerDelegate?
  • Initializer

    Declaration

    Swift

    public init(flowProvider: OnboardingFlowProviding, onboardingIDManager: OnboardingIDManaging = SingleUserOnboardingIDManager(), delegate: OnboardingControllerDelegate? = nil)

    Parameters

    flowProvider

    provides a flow

    onboardingIDManager

    provides the proper flow which should start when openFlow is called and manages the onboarding ID of the flow

    delegate

    delegate that tracks the progress of the given flow. The delegate stored with weak reference

  • Opens a flow. Using onboardingIDManager decides whether it should be an onboarding, restoring or resetting flow. By default this method runs recursively until a successful onboard/restore or a critical error. The delegate is asked during the flows to decide what should be treated as critical error and whether should stop the flow or should restart ‘openFlow’ automatically. In case of restart the onboardingIDManager is called again since a failure can remove an onboarded session.

    Declaration

    Swift

    public func openFlow(_ completionHandler: @escaping (OnboardingFlow?, Error?) -> Void)

    Parameters

    completionHandler

    called asynchronously when finished. OnboardingFlow provided on success, the Error parameter otherwise

  • Removes a persisted onboarding identified by its ID so it cannot be restored anymore

    Declaration

    Swift

    public func resetFlow(for onboardingID: UUID, completionHandler: @escaping (Error?) -> Void)

    Parameters

    onboardingID

    the onboarding ID of the session you want to remove

    completionHandler

    closure called on completion

  • Onboards with the given flow

    Declaration

    Swift

    public func onboard(flow: OnboardingFlow, completionHandler:@escaping (OnboardingFlow?, Error?) -> Void)

    Parameters

    flow

    OnboardingFlow on which the onboarding opearation should be performed

    completionHandler

    closure called on completion

  • Restores the given flow

    Declaration

    Swift

    public func restore(flow: OnboardingFlow, completionHandler: @escaping (OnboardingFlow?, Error?) -> Void)

    Parameters

    flow

    OnboardingFlow on which the restoring opearation should be performed

    completionHandler

    closure called on completion

  • Reset the given flow

    Declaration

    Swift

    public func reset(flow: OnboardingFlow, completionHandler: @escaping (Error?) -> Void)