Swift performSegueWithIdentifier not working

后端 未结 8 1513
礼貌的吻别
礼貌的吻别 2020-12-01 04:13

I am trying to switch view controllers after a user successfully logs in to their account, but it is not working correctly. I cant use a segue directly because if the login

8条回答
  •  醉梦人生
    2020-12-01 04:46

    An example in a login. When you have success in your login after clicking a button (Action) you can use:

    self.performSegue(withIdentifier: "loginSucess", sender: nil)
    

    But if you are launching the app and you got the credentials from your keychain you need to use this as a part of the theard:

    DispatchQueue.main.async(){
        self.performSegue(withIdentifier: "sessionSuccess", sender: nil)
    }
    

提交回复
热议问题