Last active
August 29, 2015 14:09
-
-
Save bobspryn/94472f0285139056da26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RACSignal *controlUpdate = [myButton rac_signalForControlEvents:UIControlEventTouchUpInside]; | |
// signals for UIControl events send the control event value (UITextField, UIButton, UISlider, etc) | |
// subscribeNext:^(UIButton *button) { NSLog(@"%@", button); // UIButton instance } | |
RACSignal *textChange = [myTextField rac_textSignal]; | |
// some special methods are provided for commonly needed control event values off certain controls | |
// subscribeNext:^(UITextField *textfield) { NSLog(@"%@", textfield.text); // "Hello!" } | |
RACSignal *alertButtonClicked = [myAlertView rac_buttonClickedSignal]; | |
// signals for some delegate methods send the delegate params as the value | |
// e.g. UIAlertView, UIActionSheet, UIImagePickerControl, etc | |
// (limited to methods that return void) | |
// subscribeNext:^(NSNumber *buttonIndex) { NSLog(@"%@", buttonIndex); // "1" } | |
RACSignal *viewAppeared = [self rac_signalForSelector:@selector(viewDidAppear:)]; | |
// signals for arbitrary selectors that return void, send the method params as the value | |
// works for built in or your own methods | |
// subscribeNext:^(NSNumber *animated) { NSLog(@"viewDidAppear %@", animated); // "viewDidAppear 1" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment