0

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).

Filip Hermans
  • 272
  • 1
  • 4
  • Have you seen this discussion on RAC github repo? https://github.com/ReactiveCocoa/ReactiveCocoa/issues/1849 – Jakub Vano Jul 01 '15 at 07:48
  • I did and it was of no help to me. It is not a main thread issue and the discussion talks about `rac_signalForControlEvents` which is defined on UIControl, not NSControl. – Filip Hermans Jul 01 '15 at 08:18

0 Answers0