Igal Flegmann
Igal Flegmann

Reputation: 642

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

Upvotes: 0

Views: 39

Answers (1)

EmilioPelaez
EmilioPelaez

Reputation: 19912

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.

Upvotes: 1

Related Questions