0
votes

The first part of my app is a Sign in section with built in Navigation controller. When the sign up section is completed and a new user is created I would like to proceed into a UITabBarController and will add seperate navigation controllers for each tab. Right now when sign up is complete and my UITabBarController is presented it still shows the UINavigationController from the first section of my app. How do I exit the UINavigationController once I enter the new UITabBarController?

enter image description here

enter image description here

And here is the code

import UIKit

class SignUpSecondViewController: UIViewController, BEMCheckBoxDelegate {

@IBAction func completeButtonAction(_ sender: Any) {

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let vc = storyboard.instantiateViewController(withIdentifier: "NewTabBarViewController") as! UIViewController
    // Alternative way to present the new view controller
    self.navigationController?.show(vc, sender: nil) 
}
1

1 Answers

1
votes

You should better use

self.navigationController?.present(vc, animated: true, completion: nil)

Generally there is no need for signup once main tabbar controller is up. In this case you can do this which will remove signup from memory.

let appDelegate = UIApplication.shared.delegate as! AppDelegate)
appDelegate.window?.rootViewController = vc