So, in iOS development, I use ReactiveCocoa and with that framework I am able to observe multiple NSObjects and combine them into a signal that returns a a value. Something like this:
-(RACSignal *)modelIsValidSignal {
return [RACSignal combineLatest:@[RACObserve(self,username), RACObserve(self,password), RACObserve(self, busyLoggingIn)]
reduce:^id(NSString *username, NSString *password, NSNumber *busyLoggingIn) {
return @((username.length > 0) && (password.length > 0 && busyLoggingIn.boolValue == NO));
}];
}
So, this will return a boolean that is either false or true. As soon as one of the objects state changes, this signal would be notified and the subscriber (Observer) would then get that current value of the boolean.
How do I do something similar to this, using LiveData? the closest thing to doing this, is MediatorLiveData but, I don't see how I can observe multiple LiveData events at the same time and then reduce it, like in the above example.