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 thesteps
parameter in order they are provided. Calls the next step only when the previous step called itscompletionHandler
witch success. When a step fails the flow is stopped, all the step is called withreset
and thecompletionHandler
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 isTrue
.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 thesteps
parameter in order they are provided. Calls the next step only when the previous step called itscompletionHandler
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.
-
Runs a background flow by calling
background
on each step asycnhronously provided in thesteps
parameter in order they are provided. Calls the next step only when the previous step called itscompletionHandler
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 background(on steps: [OnboardingStep], context: OnboardingContext = OnboardingContext(), completionHandler: @escaping (OnboardingResult) -> Void)
Parameters
steps
The
OnboardingStep
array which represents a backround 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 background flow with the result of the last step or the result of the first failing step.
-
Runs an reset passcode flow by calling
resetPasscode
on each step asycnhronously provided in thesteps
parameter in order they are provided. Calls the next step only when the previous step called itscompletionHandler
witch success. When a step fails the flow is stopped, all the step is called withreset
and thecompletionHandler
will 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
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 isTrue
.completionHandler
Called 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
flow
provided in the steps parameter by callingreset
method 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
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.