I would like to do the opposite of the following code:
RAC(self.activityIndicator, hidden) = RACObserve(self.playButton, selected);
When the play button is selected the activity indicator should be NOT hidden.
What is the best way to do this using ReactiveCocoa?
There's a signal operator for this, -not
.
RAC(self.activityIndicator, hidden) = [RACObserve(self.playButton, selected) not];
map:
is what you need.
RAC(self.activityIndicator, hidden) = [RACObserve(self.playButton, selected) map:^id(id value) {
return @(![value boolValue]);
}];
This transforms the signal into another one based on what you return from the map function.
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