Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to block execution of my code until UIAlertController is dismissed?

is there anyway to wait the user to press the button that dismiss the alertController in swift 3, by using DispatchQueue or something else?

like image 254
Anthony Shahine Avatar asked Nov 10 '16 06:11

Anthony Shahine


1 Answers

Just move all the code you want to execute after the alert is dismissed into a separate method. When you're adding UIAlertActions, make all the actions' handler parameter call that method. This way, whichever button the user presses, your code will always be executed!

like image 188
Sweeper Avatar answered Sep 22 '22 08:09

Sweeper