By Using the touchesBegan method as follow
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
textFieldName.resignFirstResponder()
self.view.endEditing(true)
}
By Using the touchesBegan method as follow
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
textFieldName.resignFirstResponder()
self.view.endEditing(true)
}