Deprecated!!!
This project is deprecated in favor of the new one https://github.com/zummenix/KeyboardNotificationsObserver
The new project has more modern and convenient interface, fixes some pitfalls of the current project and, did I mention, it has better interface ;). I hope you like it.
A safe wrapper for UIKeyboard notifications written in Swift.
- Import module
import KeyboardWrapper
- Create
KeyboardWrapper
instance
keyboardWrapper = KeyboardWrapper(delegate: self)
- Implement
KeyboardWrapperDelegate
extension ViewController: KeyboardWrapperDelegate {
func keyboardWrapper(_ wrapper: KeyboardWrapper, didChangeKeyboardInfo info: KeyboardInfo) {
if info.state == .willShow || info.state == .visible {
bottomConstraint.constant = info.endFrame.size.height
} else {
bottomConstraint.constant = 0.0
}
view.layoutIfNeeded()
}
}
- iOS 8.0 or higher
- Xcode 9.0 (swift 4.0) or higher
For older versions of xcode and swift please use 3.0.1
version of the lib.
Take a look at change log.
KeyboardWrapper is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'KeyboardWrapper', '~> 4.1'
Just drop the KeyboardWrapper.swift
file into your project. That's it!
KeyboardWrapper is available under the MIT license. See the LICENSE file for more info.