How can I make a function complete before calling others in an IBAction?
I'm having trouble understanding completion handlers. I have a textFieldEditingDidChange IBAction that calls first a verify() function on the textfield input and then an if statement on the boolean returned by apply. The problem is that the if statement starts before verify() has finished . Here is the code: @IBOutlet weak var myTextField: UITextField! @IBAction func myTextFieldEditingDidChange(sender: AnyObject) { let yo = verify(myTextField.text!) print("\(yo)") // it always prints "true" because verify hasn't finished } func verify(myText: String) -> Bool { var result = true // some code