Good afternoon!
Excuse me for my English.
I've got a problem trying to assign textView's delegate to another class.
In CommentsViewController's viewDidLoad I've done this
newCommentTextView.delegate = CommentTextViewDelegate()
I've added and textViewDidChange, and textViewDidEndEditing, and _:shouldChangeTextInRange:... . But none of these functions are called, when I change textView's text!
What's wrong with me? Thank you.
delegate is a weak pointer. So you need make property of CommentTextViewDelegate class, then assign it to text view delegate as per below code. After this you will be getting notify whenever any changes occur.
let textViewDelegate = CommentTextViewDelegate()
func viewDidLoad() {
newCommentTextView.delegate = textViewDelegate
}