Skip to content

Instantly share code, notes, and snippets.

@PetreVane
Created January 7, 2020 15:44
Show Gist options
  • Save PetreVane/c8bda678f2fceff26600f8fa1f224a79 to your computer and use it in GitHub Desktop.
Save PetreVane/c8bda678f2fceff26600f8fa1f224a79 to your computer and use it in GitHub Desktop.
This methods adds a gesture recognizer on your current view, which dissmises the keyboard when tapped away
func dismissKeyboardGesture() {
let tapGesture = UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing(_:)))
view.addGestureRecognizer(tapGesture)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment