In iOS 12 I have a new password textfield for a sign up flow and I want the system to suggest a strong one. I also have a button that enables and disables based on the delegate method and I do some changes etc.
textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String)
This works good for enabling it when the user taps Use Strong Password
.
But I don't seem to get a delegate callback for when a user might tap Choose My Own Password
and a s a result my button enable/disable logic never gets a chance to execute, allowing someone to sign up with a blank password.
Any ideas on what I might have t do to get a callback when the user taps Choose my own password
? Any help is greatly appreciated.
I faced the same issue, but the only thing I found out was providing callbacks was the viewDidLayoutSubviews
delegate of the UIView
So what I did is use this:
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if passwordTextField.isFirstResponder {
validatePassword(passwordTextField.text ?? "")
}
}
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