You can't use RAC()
directly on a UIButton because of the UIKit design:
RAC(self.button.titleLabel, text) = titleSignal; // Don't do this.
One of the solutions is using dynamic property to support RAC()
binding macro:
// .h
@interface UIButton (RACTitleSupport)
@property (strong, nonatomic) NSString *racExt_Title;
@end
// .m
@implementation UIButton (RACTitleSupport)
@dynamic racExt_Title;
- (void)setRacExt_Title:(NSString *)racExt_Title
{
[self setTitle:racExt_Title forState:UIControlStateNormal];
}
- (NSString *)racExt_Title
{
return [self titleForState:UIControlStateNormal];
}
@end
Now you can use RAC()
binding macro like this:
RAC(self, button.racExt_Title) = titleSignal;
Cheers <3