Forked from kastiglione/rac_keyboard_showing_snippet.rb
Created
November 7, 2014 08:28
-
-
Save zhigang1992/e5d6dce0e7af0ee53f67 to your computer and use it in GitHub Desktop.
This file contains 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
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) |
This file contains 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
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