func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
textView.resignFirstResponder()
return false
}
Swift 4 , Xcode 9.1 GM
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
adjustFrames()
return textView.text.count + (text.count - range.length) <= 200
}