Dismiss keyboard

Dismiss keyboard after pressing Return

Set the view controller delegate to an object which implements the method textFieldShouldReturn(_) in the protocol UITextFieldDelegate.

Swift 2.3
// MARK: UITextFieldDelegate

    When the user hits the return or "Done" button on a text field, we want 
    the keyboard to go away.
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
    return true