I want to embed a Navigation controller with the container view and use the same navigation controller to push some other view controller. Here is the workaround with the help of storyboard.
Can I embed the navigation controller with Container View programmatically? I can able to add SecondViewController's content as a subview in the container view. But in that case, my Navigation controller will not work.
In the BaseViewController I have added this code,
let secondViewController = self.storyboard?.instantiateViewController(withIdentifier: "SecondViewController")
let navigationController = CustomNavigation(rootViewController: secondViewController!)
// taking a navigation controller reference, so that I can use this to Push other view controller.
Helper.shared.customNavController = navigationController
self.addChildViewController(navigationController)
secondViewController?.view.frame = CGRect(x: 0, y: 0, width: containerView.frame.size.width, height: containerView.frame.size.height)
containerView.addSubview((secondViewController?.view)!)
It added the SecondViewController's content in the Container View. But using this navigation controller (Helper.shared.customNavController) I am not able to Push any other View Controller.