Currently I am trying to redirect user to dashboard after checking if they have valid credentials. This is my code below. I've tried creating variables (bools) to check for this condition, however, variables don't save updated value in completion handler
@IBAction func loginPressed(_ sender: UIButton){ //login works
guard let email = enterEmailTextField.text else {return}
guard let password = enterPasswordTextField.text else {return}
let loginModel = LoginModel(username: email, password: password)
APIManager.shareInstance.loginUserAPI(login: loginModel) { (result) in
switch result{
case .success(let json):
print(json as AnyObject)
case .failure(let err):
print(err.localizedDescription)
}
}
}
So my question is, how do I "extract" some type of information when the user logs in (confirming valid credentials) and then redirect to another view?
Thank you in advance!