How can I dismiss the keyboard when a button is pressed, programmatically with swift?
There is also the so called "big hammer".
Just call self.view.endEditing(true)
self.view.endEditing(true)
The documentation states the following for this method:
Causes the view (or one of its embedded text fields) to resign the first responder status.