keyboard done key action swift iOS doesn’t work

You need to implement delegate method which is called when you hit done button:

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
    textField.resignFirstResponder()
    return true
}

You also need to conform to UITextFieldDelegate protocol:

// I assume you override UIViewController class. If not add UITextFieldDelegate to your class
class MyViewController: UIViewController, UITextFieldDelegate

The last thing is set up your class to be a text field delegate:

textField.delegate = self

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)