How can I detect backspace in UITextView in Swift.
I have seen many solutions regarding UITextField but could not find any solution with regard to UITextView
How can I detect backspace in UITextView in Swift.
I have seen many solutions regarding UITextField but could not find any solution with regard to UITextView
UITextViewDelegate
method will help you to detect backspace
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if text == "" && range.length > 0 { //Backspace
}
return true
}