Skip to content

Instantly share code, notes, and snippets.

@jdewind
Created January 20, 2014 21:48
Show Gist options
  • Save jdewind/8529874 to your computer and use it in GitHub Desktop.
Save jdewind/8529874 to your computer and use it in GitHub Desktop.
@implementation UISearchBar (RAC)
- (RACSignal *)rac_editing {
// Pretend we have an ivar I know we'd use setAssociatedObject
_proxy = [[RACDelegateProxy alloc] initWithProtocol: @protocol(UISearchBarDelegate)];
return [@[
[[_proxy signalForSelector: @selector(searchBarTextDidBeginEditing:)] mapReplace: @YES],
[[_proxy signalForSelector: @selector(searchBarTextDidEndEditing:)] mapReplace: @NO]
].rac_sequence.signal switchToLatest];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment