The solution you describe, implementing a method that calls -sendNext:
on a subject, is so common that there's a method that does that all for you: -rac_signalForSelector:
. In the case of delegates, you can call -rac_signalForSelector:
on the delegate, like so:
RAC(self.headerView, hidden) = [[(id)scrollView.delegate
rac_signalForSelector:@selector(scrollViewDidScroll:)]
reduceEach:^(UIScrollView *scrollView) {
return @(scrollView.contentOffset.y > 0);
}];
One gotcha that comes up with delegates is that you must make sure you invoke any -rac_signalForSelector:
calls before assigning the delegate.