2

I want to do pushViewController on rootViewController in current sample of NavigationDrawerController https://github.com/CosmicMind/Samples/blob/master/Projects/Programmatic/NavigationDrawerController/NavigationDrawerController/RootViewController.swift

and as well as in TransitionedViewController https://github.com/CosmicMind/Samples/blob/master/Projects/Programmatic/NavigationDrawerController/NavigationDrawerController/TransitionedViewController.swift

Nothing is happening if I call navigationController?.pushViewController(MyController(), animated: true)

If attach NavigationController to rootViewController then center rootViewController will not change on tap of leftViewController

(navigationDrawerController?.rootViewController as? ToolbarController)?.transition(to: TransitionedViewController(), completion: closeNavigationDrawer)

This is because rootViewController doesn't have NavigationController. If I attach AppToolbarController to rootView then navigation will not work and if I attach AppToolbarController to rootViewController then navigationDrawer transition will not work.

Please help!

Tariq
  • 9,861
  • 12
  • 62
  • 103

1 Answers1

0

Your setup sounds like it is trying to combine more than one idea. So I am slightly confused, but from your issue's title "How to call pushViewController in NavigationDrawerController" - the code to call pushViewController from the NavigationDrawerController where the NavigationDrawerController.rootViewController is a NavigationController do this:

(navigationDrawerController?.rootViewController as? NavigationController)?.pushViewController(MyViewController(), animated: true)

Let me know how that works for you, all the best :)

CosmicMind
  • 1,499
  • 1
  • 10
  • 6