This is my ViewModel core code
let isEnable = Observable.combineLatest(input.username, input.password) { u, p in
return u?.isEmpty == false && p?.isEmpty == false
}.asDriver(onErrorJustReturn: false)
Driver code
ouputs.isLoginButtonEnable.debug("v1", trimOutput: false).drive(self.loginButton.rx.valid).disposed(by: bag)
Set text with code
@IBAction func CT(_ sender: Any) {
// not working
// self.usernameTF.text = "111"
// self.passwordTF.text = "222"
// also not working
// self.usernameTF.rx.text.onNext("1111")
// self.passwordTF.rx.text.onNext("3333")
}
I want to bind the UITextField text to determine whether the login button is clickable or not.
It works fine with manual text input.
It does not work when I use the code to set the text property.
Can anyone help me?