My UIViewController confirms to UITextFieldDelegate and implements delegate method:
func textFieldDidEndEditing(_ textField: UITextField)
It also sets delegate = self in viewDidLoad
All works fine when user enters text from keyboard. However, the above delegate method is not called when I set text programatically.
i.e textField.text = "some text"
I have also tried calling textField.sendActions(for: .editingDidEnd). Please note that I need to trigger this delegate method while writing unit tests for my controller.
textproperty in code does not change the status of the first responder.