I am a newbie in iOS. What i want is that when a user gets successfully signed up, next view controller should appear. What I used for this purpose is prepareForSegue. User is getting signed in successfully. Debugging shows that prepareForSegue is also getting called but it's not showing the next screen. I also wanna send my "user" variable along with segue. Here is my code.
@IBAction func signUpTapped(_ sender: AnyObject!) {
let password = "password"
phone?.name = "phone_number"
phone?.value = "######"
email?.name = "email"
email?.value = "######"
attributes.append(phone!)
attributes.append(email!)
let userPool = appDelegate.userPool;
userPool?.signUp("user7", password: password, userAttributes: attributes, validationData: nil).continueWith { (task) -> Any? in
print("Successfully registered user: \(task.result!.user)");
print("error: \(task.error)");
self.user = task.result!.user
self.performSegue(withIdentifier: "toConfirmationCodeScreen", sender: self)
return nil
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "toConfirmationCodeScreen") {
let secondViewController = segue.destination as! ConfirmationCodeViewController
let user = sender as! AWSCognitoIdentityUser
secondViewController.user = self.user
}
}
Any help would be greatly appreciated.
P.s I am using Swift 3, Xcode 8.