OnboardingFlowController

public class OnboardingFlowController

Runs an onboarding / restoring flow by calling the steps asynchronously one by one in order they stored in the array. Stops the iteration if a step fails. Changes the state property of the FlowPresentationDelegate according to the current flow, and sets it back to general at the end of the flow.

  • The presentation state: provides information about the state of the OnboardingFlow

    Declaration

    Swift

    public static var presentationState: PresentationState
  • Runs an onboarding flow by calling onboard on each step asycnhronously provided in the steps parameter in order they are provided. Calls the next step only when the previous step called its completionHandler witch success. When a step fails the flow is stopped, all the step is called with reset and the completionHandler will be called with the error the step failed.

    Declaration

    Swift

    public static func onboard(on steps: [OnboardingStep], context: OnboardingContext = OnboardingContext(), shouldResetOnError: Bool = true, completionHandler: @escaping (OnboardingResult) -> Void)

    Parameters

    steps

    The OnboardingStep array which represents an onboarding flow.

    context

    Initial context passed to the first step. All other step gets the result context of the previous step. Default is an empty context.

    shouldResetOnError

    If this flag is True and an error happen during the flow then the reset flow is called with the supplied onboarding steps. By default this value is True.

    completionHandler

    Called on the end of the onboarding flow with the result of the last step or the result of the first failing step.

  • Runs a restoring flow by calling restore on each step asycnhronously provided in the steps parameter in order they are provided. Calls the next step only when the previous step called its completionHandler witch success. When a step fails the flow is stopped. It is up to the app developer to handle the error cases.

    Declaration

    Swift

    public static func restore(on steps: [OnboardingStep], context: OnboardingContext = OnboardingContext(), completionHandler: @escaping (OnboardingResult) -> Void)

    Parameters

    steps

    The OnboardingStep array which represents a restoring flow.

    context

    Initial context passed to the first step. All other step gets the result context of the previous step. Default is an empty context.

    completionHandler

    Called on the end of the restoring flow with the result of the last step or the result of the first failing step.

  • Resets all the steps in a flow provided in the steps parameter by calling reset method on them. It could be interpreted as the reverse operation of the onboard (of step) in which is called. After reset, the onboarding is invalidated, all dependent data (onbardingId, secure databases etc.) must be removed. The application developer has to make sure to clear all remaining dirty data.

    Declaration

    Swift

    public static func reset(on steps: [OnboardingStep], context: OnboardingContext = OnboardingContext(), completionHandler: @escaping () -> Void)

    Parameters

    steps

    The OnboardingStep array on which reset will be called.

    context

    Initial context passed to the first step. All other step gets the result context of the previous step. Default is an empty context.

    completionHandler

    Called on the end of the restoring flow.