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
OnboardingFlowDeclaration
Swift
public static var presentationState: PresentationState -
Runs an onboarding flow by calling
onboardon each step asycnhronously provided in thestepsparameter in order they are provided. Calls the next step only when the previous step called itscompletionHandlerwitch success. When a step fails the flow is stopped, all the step is called withresetand thecompletionHandlerwill 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
stepsThe
OnboardingSteparray which represents an onboarding flow.contextInitial context passed to the first step. All other step gets the result context of the previous step. Default is an empty context.
shouldResetOnErrorIf this flag is
Trueand an error happen during the flow then the reset flow is called with the supplied onboarding steps. By default this value isTrue.completionHandlerCalled 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
restoreon each step asycnhronously provided in thestepsparameter in order they are provided. Calls the next step only when the previous step called itscompletionHandlerwitch 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
stepsThe
OnboardingSteparray which represents a restoring flow.contextInitial context passed to the first step. All other step gets the result context of the previous step. Default is an empty context.
completionHandlerCalled on the end of the restoring flow with the result of the last step or the result of the first failing step.
-
Runs a background flow by calling
backgroundon each step asycnhronously provided in thestepsparameter in order they are provided. Calls the next step only when the previous step called itscompletionHandlerwitch 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 background(on steps: [OnboardingStep], context: OnboardingContext = OnboardingContext(), completionHandler: @escaping (OnboardingResult) -> Void)Parameters
stepsThe
OnboardingSteparray which represents a backround flow.contextInitial context passed to the first step. All other step gets the result context of the previous step. Default is an empty context.
completionHandlerCalled on the end of the background flow with the result of the last step or the result of the first failing step.
-
Runs an reset passcode flow by calling
resetPasscodeon each step asycnhronously provided in thestepsparameter in order they are provided. Calls the next step only when the previous step called itscompletionHandlerwitch success. When a step fails the flow is stopped, all the step is called withresetand thecompletionHandlerwill be called with the error the step failed.Declaration
Swift
public static func resetPasscode(on steps: [OnboardingStep], context: OnboardingContext = OnboardingContext(), shouldResetOnError: Bool = true, completionHandler: @escaping (OnboardingResult) -> Void)Parameters
stepsThe
OnboardingSteparray which represents an onboarding flow.contextInitial context passed to the first step. All other step gets the result context of the previous step. Default is an empty context.
shouldResetOnErrorIf this flag is
Trueand an error happen during the flow then the reset flow is called with the supplied onboarding steps. By default this value isTrue.completionHandlerCalled on the end of the reset passcode flow with the result of the last step or the result of the first failing step.
-
Resets all the steps in a
flowprovided in the steps parameter by callingresetmethod on them. It could be interpreted as the reverse operation of the onboard (of step) in which is called. Afterreset, 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
stepsThe
OnboardingSteparray on which reset will be called.contextInitial context passed to the first step. All other step gets the result context of the previous step. Default is an empty context.
completionHandlerCalled on the end of the restoring flow.