Stop tasks until AlertController action occurs Swift
<p>I tried to execute a task from the <code>completion</code> parameter of <code>present</code> so that it would execute the desired function only after the <code>UIAlertController</code> closed. However, the function was called before the action was taken in the alert. How do I wait to execute the function until an action is taken?</p>

<pre><code>let alert = UIAlertController(title: "Wild Card Played", message: "Choose your suit", preferredStyle : .alert);
for suit in suits {
    alert.addAction(UIAlertAction(title: suit, style: .default, handler: crazyEightPlayed))
                  }
self.present(alert, animated: true, completion: cpuTurn) //Upon completion call the cpuTurn() function
</code></pre>