Whenever I perform a segue to my SignUpViewController there is an error that says unexpectedly found nil when unwrapping an optional value in the view did load, here is my code.
SignUpViewController:
Here is the view controller I am performing the segue from:
SignUpViewController:
Here is the view controller I am performing the segue from:
Code Block Swift import UIKit class MainViewController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white if isLoggedIn(){ let tabBarController = TabBarViewController() viewControllers = [tabBarController] }else{ perform(#selector(showLoginController), with: nil, afterDelay: 0.01) } } fileprivate func isLoggedIn() -> Bool { return UserDefaults.standard.isLoggedIn() } @objc func showLoginController() { let loginController = LoginViewController() present(loginController, animated: true, completion: { }) } }