I have one view controller (without embedded in to navigation controller). Let say mainVC, from maninVC i have one button called goNext. When i tap i need to psuh my same VC mainVC with some changes in label.
So i did :
This is in app delegate :
let storyBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let exampleVC = storyBoard.instantiateViewController(withIdentifier: "MainVC")
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = exampleVC
self.window?.makeKeyAndVisible()
My vc :
func pushToMainVc() {
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let loginPageView = mainStoryboard.instantiateViewController(withIdentifier: "MainVC") as! MainVC
let rootViewController = self.window?.rootViewController as? UINavigationController
rootViewController?.pushViewController(loginPageView, animated: true)
}
But its not making the push. Any help would be great.
Thanks