passWordInputView.inputTextField.rx.controlEvent(.editingDidEnd)
.bindTo(loginButton.rx.tap)
.disposed(by: disposeBag)
when password edit done then login
but get error: Type 'inout UIButton' does not conform to protocol 'ReactiveCompatible'
Since RxSwift contains the following line, you can be pretty sure that something else is giving the compiler trouble when you get this error for any NSObject subclass (anything in UIKit).
extension NSObject: ReactiveCompatible { }
In my experience this error happens when trying to use rx methods or operators incorrectly or if there is some syntactical error.
For example I got this error for a collectionView when trying to merge two streams like this
Observable.merge(collectionView.rx.streamOne, streamTwo)
But the correct way to merge the two streams is
Observable.of(collectionView.rx.streamOne, streamTwo).merge()
(Note looks like static Observable.merge was added in RxSwift 3.4)
You are trying to bind the stream from inputTextField.rx.controlEvent(.editingDidEnd)
which is Observable<Void>
to loginButton.rx.tap
which is an Observable, and not an Observer. In english, button.rx.tap
is meant to be observed, and not meant to observe.
You may instead do something like this
inputTextField.rx.controlEvent(.editingDidEnd)
.subscribe(onNext: { [unowned self] in
self.inputTextField.userInteractionEnabled = false
self.doLogin()
}
You could also merge the streams from the button and the textField as described above :)
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