Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to dismiss keyboard in iOS
import UIKit
class RegistrationViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var firstNameField: UITextField!
@IBOutlet weak var lastNameField: UItextField!
override func viewDidLoad(){
super.viewDidLoad()
configurations()
}
fileprivate func configurations(){
firstNameField.delegate = self
lastNameField.delegate = self
}
internal func textFieldShouldReturn(_ textField: UITextField) -> Bool {
self.view.endEditing(true)
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.