I have
@IBOutlet weak var messageTextView: UITextView
and I want that when there is a change inside the text then print to console: blabla
.
I tried to add the following function, but when I change the text nothing happens:
func textViewDidChange(_ textView: UITextView) {
switch (textView) {
case messageTextView: print("blabla")
default: break
}
}
You need to set the delegate inside viewDidLoad
textView.delegate = self
//
class ViewController: UIViewController , UITextViewDelegate {
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With