Search code examples
objective-creactive-cocoa

With ReactiveCocoa bind to inverse of BOOL


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?


Solution

  • There's a signal operator for this, -not.

    RAC(self.activityIndicator, hidden) = [RACObserve(self.playButton, selected) not];