Reputation: 35
I'm implementing Login in iOS. I want to unwind to the previous VC(IntroVC) first, and to show completed sign up alert about completed in IntroVC.
(completingSignUp is Unwind function.)
@IBAction func completingSignUp(_ segue: UIStoryboardSegue) {
let completedAlert = UIAlertController(title: "Completing", message: "Congratulations.", preferredStyle: .alert)
let ok = UIAlertAction(title: "OK", style: .default, handler: nil)
completedAlert.addAction(ok)
self.present(completedAlert, animated: true)
}
It shows only the alert without unwind to IntroVC.
I think the location of the alert code seems to be incorrect.
Where should I write alert code?
Upvotes: 2
Views: 158
Reputation: 535306
Put the code into IntroVC‘s viewDidAppear
. You will need to introduce a condition so that the alert is presented only when you are coming back via the unwind segue.
Upvotes: 1