2
votes

I'm developing an app for a client of mine and they want to be able to deeplink to a specific view controller from the app being terminated. Here is the current stack:

  • Launch Screen
  • Splash Screen (Here is where we download our config file)
  • VC1
  • VC2
  • VC3
  • VC4
  • VC5

The client wants the ability, via a deeplink, to launch the app, and after the Splash Screen completes the config file download, to navigate to a specific view controller (VC1-VC5). The issue is that they want to retain the stack. So i cannot simply push VC5 from the Splash Screen because VC5 needs the ability to go back to VC4 than VC3 than VC2, etc.

What is the best way to handle this? Any help would be greatly appreciated. Thanks in advance!

1
If you have a storyboard then you could have different seques to go to different VC's,Knight0fDragon
you could add a flag in the appDelegate. If App launched via url-scheme then set this flag. And in each VC viewDidLoad check on this flag, and just push the lower-level VCthomas gotzsche

1 Answers

4
votes

You can set a navigation stack all at once by using the UINavigationController setViewControllers method. Just create an instance of each view controller and pass them to your nav controller like this:

navController.setViewControllers([vc1, vc2, vc3, vc4, vc5], animated: true)

Just be aware that this will overwrite all view controllers currently in the navigation stack. vc1 would become your navigation controller's root vc.