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

With Swift 3.0 you can do something like:

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

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.