pudm pudm - 4 months ago 9x
Swift Question

change view from view will appear

I am checking if the user is logged in and if it is I want to go straight to the main menu (skipping login screen) right now i have this in the login viwillAppear

if currentUser != nil {
self.performSegueWithIdentifier("login_success", sender: self)

It does go into the if statement but it does not change views. thanks


viewWillAppear is called when the view is not in the view hierarchy yet, which is a requirement for performing a segue.

Your options are to call it in viewDidAppear, though users will see the first screen before the transition, or perform that check before displaying the login screen.