Classes
The following classes are available globally.
-
Mechanica
KeyboardObserver
is an UIKit keyboard’s behavior observer (for iOS apps) without Notification Center.Declare what should happen on what event and
register()
.let keyboard = KeyboardObserver() keyboard .on(event: .didShow) { (options) in print("didShow") } .on(event: .didHide) { (options) in print("didHide") } .register() }
You must call
register()
for callbacks to be triggered.Calling
unregister()
will stop callbacks from triggering (UIKit’s notifications won’t be observed anymore), but callbacks themselves won’t be dismissed; you can resume event callbacks by callingregister()
again.To remove all event callbacks, call
See moreclear()
.Declaration
Swift
public final class KeyboardObserver