CactusKeyboard is a usless helper for keyboard observing. It uses system notifications and have UIViewController extension functions, so you don't need to restructure your project, just use extension functions.
Import CactusKeyboard in the file:
import CactusKeyboardThen add observer to yout ViewController:
override func viewDidLoad() {
super.viewDidLoad()
addKeyboardObserver { [weak self] (visible, height) in
guard let `self` = self else { return }
print("\(self) keyboard visible: \(visible) height: \(height)")
}
}
deinit {
removeKeyboardObserver()
}CactusKeyboard is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CactusKeyboard'MaksimVialykh, maxim.vialykh@cactussoft.biz
CactusKeyboard is available under the MIT license. See the LICENSE file for more info.