In the most straightforward implementation, the Onboarding flow can simply be presented in a modal context, since semantically the User is on a single journey.
[Apple Human Interface Guidelines – Modality][1]:
Consider creating a modal context only when it’s critical to get someone’s attention, when a task must be completed or abandoned to continue using the app, or to save important data.
Presenting modally allows the simple option of dismissal at the end of the journey, with little of the cruft of swapping controllers.
Custom transitions are also supported in the standard way, since this uses the ViewController.present()
API:
// MARK: - Onboarding
extension AppDelegate {
func showOnboarding() {
if let window = window, let onboardingViewController = UIStoryboard(name: "Onboarding", bundle: nil).instantiateInitialViewController() as? OnboardingViewController {
onboardingViewController.delegate = self
window.makeKeyAndVisible()
window.rootViewController?.present(onboardingViewController, animated: false, completion: nil)
}
}
func hideOnboarding() {
if let window = UIApplication.shared.keyWindow {
window.rootViewController?.dismiss(animated: true, completion: nil)
}
}
}