A NSSegmentedControl instance is bound to a ViewController as
@property (weak) IBOutlet NSSegmentedControl *mySegmentedControl;
In the viewDidLoad method, a signal is created (and subscribed to) for the selectedSegment property of the NSSegmentedControl:
[RACObserve(self.mySegmentedControl, selectedSegment) subscribeNext:^(id x) {
NSLog(@"Next is called only once.");
}];
The subscribeNext block is however only executed once, just after the creation of the signal, no error nor complete messages are sent.
When using the hidden
instead of the selectedSegment
property for example, the subscribeNext block gets executed whenever the hidden
state of the NSSegmentedControl changes.
Is this a KVO issue? How do I solve this, i.e. how to make a RACSignal from the selectedSegment property of a NSSegmentedControl?
(This is a Mac issue only, iOS has some nifty categories on UIControl and its subclasses that seem to do the trick).