Chapter 19:Action _ Composing behavior

let loginPasswordObservable =
Observable.combineLatest(loginField.rx.text, passwordField.rx.text) {
($0, $1) }
loginButton
.withLatestFrom(loginPasswordObservable)
.bind(to: loginAction.inputs)
.disposed(by: disposeBag)
I don’t get it , because ‘button’ seems like it has no member ‘withLatestFrom’.

@fpillet Can you please help with this when you get a chance? Thank you - much appreciated! :]

@vlho Good catch! It’s a typo, the code should read:

let loginPasswordObservable = Observable.combineLatest(loginField.rx.text, passwordField.rx.text) {
  ($0, $1)
}
loginButton.rx.tap
  .withLatestFrom(loginPasswordObservable)
  .bind(to: loginAction.inputs)
  .disposed(by: disposeBag)

When I typed this code I forgot to include the .rx.tap which is the actual Observable<Void> firing every time a button is pressed.

We’ll get this fixed for the next iteration of the books. Thanks!

1 Like

Thanks for your explanation!

This topic was automatically closed after 166 days. New replies are no longer allowed.