Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zhigang1992/e5d6dce0e7af0ee53f67 to your computer and use it in GitHub Desktop.
Save zhigang1992/e5d6dce0e7af0ee53f67 to your computer and use it in GitHub Desktop.
keyboard_notification = -> name {
NSNotificationCenter.defaultCenter.rac_addObserverForName(name, object:nil)
}
rac.showing_keyboard = RACSignal.merge!(
keyboard_notification.call(UIKeyboardWillShowNotification).map! {|_| true },
keyboard_notification.call(UIKeyboardWillHideNotification).map! {|_| false}
).takeUntil(self.rac_willDeallocSignal)
class RACSignal
def self.merge!(*signals)
self.merge(signals)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment