In RxSwift / RxCocoa 2.0.0-beta 3, I have a ViewModel with:
let someString = Variable("")
func isValidSomeString() -> Observable<Bool> {
if someString.value.characters.count == 0 {
return just(false)
}
return just(true)
}
I have someString binding already to the text field in the ViewController.
Whenever someString changes (or perhaps a text box if this is the best way), I want the button to be enabled based on if someString.
I tried using the "Observable <Bool>", but started to go down a different path. I could do it in the ViewController:
someViewModel.someString.subscribeNext { text -> Void in
}.addDisposableTo(disposeBag)
Is there no other way that is less verbose than the isValidSomeString (text) method? We already had good success with isValidLogin, which returns the Observable <Bool> that used combLatest.