let me explain my question with an example
I have a UITextField and want to limit its text and also have a UILabel that tells how many more characters can the user type. Thus when I start typing, everything is running great, I am using this delegate function:
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {}
But when i assign text like this : textField.text = "Hello"
,
the above mention method is not called and thus the counter label value is not changed,
I have also tried: textField?.addTarget(self, action: #selector(txtFieldChanged), for: .allEditingEvents)
but no luck