Best way to dismiss Keyboard in a View Controller iOS (Swift)
Kaushal Elsewhere
4358

With Swift 3.0 you can do something like:

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
self.view.endEditing(true)
}

in your view controller you wish to have this behavior on. It also works “through” other views, such as tapping on a label that’s in your view.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.