Hiding Keyboard when tapped outside

override func viewDidLoad() {
super.viewDidLoad()
//MARK: recognizing the taps on the app screen, not the keyboard...
let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(hideKeyboardOnTap))
tapRecognizer.cancelsTouchesInView = false
view.addGestureRecognizer(tapRecognizer)
}
//MARK: Hide Keyboard...
@objc func hideKeyboardOnTap(){
//MARK: removing the keyboard from screen...
view.endEditing(true)
}
Last updated