Dismiss the keyboard after account name is finished editing

This commit is contained in:
Phil Viso 2019-05-19 16:01:14 -05:00
parent 80e1888244
commit 4383f269a5
1 changed files with 11 additions and 1 deletions

View File

@ -21,6 +21,7 @@ class DetailAccountViewController: UITableViewController {
guard let account = account else { return }
nameTextField.text = account.name
nameTextField.delegate = self
activeSwitch.isOn = account.isActive
}
@ -29,5 +30,14 @@ class DetailAccountViewController: UITableViewController {
account?.name = nameTextField.text
account?.isActive = activeSwitch.isOn
}
}
extension DetailAccountViewController: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
nameTextField.resignFirstResponder()
return true
}
}