-1

I am trying to check if user has logged in before and send them to the home screen if they have. The condition is being met (print is executing) but the segue is not being performed. Function call is in viewDidLoad().

I use the same exact segue statement for a user logging in and it works.

    func checkIfSignedInAlready() {
        //check if user has signed in already
        if UserDefaults.standard.string(forKey: "appleAuthorizedUserIdKey") != nil {
                // move to main view
            print("USER HAS SIGNED IN BEFORE")
            performSegue(withIdentifier: "LogIn", sender: nil)
        }
    }
TrevPennington
  • 435
  • 5
  • 15

1 Answers1

0

Update - found this in Apple Docs:

"The current view controller must have been loaded from a storyboard. If its storyboard property is nil, perhaps because you allocated and initialized the view controller yourself, this method throws an exception."

So I put the function call in viewDidAppear() and it works but is presented Modally for some reason. The 'kind' is set to 'show' in Storyboard. Any thoughts on that?

TrevPennington
  • 435
  • 5
  • 15