Skip to content

Instantly share code, notes, and snippets.

@tsraveling
Created April 18, 2017 23:53
Show Gist options
  • Save tsraveling/2c7edac4f0607fa553ec5ea458f158cd to your computer and use it in GitHub Desktop.
Save tsraveling/2c7edac4f0607fa553ec5ea458f158cd to your computer and use it in GitHub Desktop.
UITextView delegate
// MARK: - UITextViewDelegate -
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if text == "\n" {
textView.resignFirstResponder()
return false
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment