An observer for UIKeyboard
notifications that provides a safe and convenient interface.
import KeyboardNotificationsObserver
KeyboardNotificationsObserver
instance as a property (for example on a view controller)private let keyboardObserver = KeyboardNotificationsObserver()
override func viewDidLoad() {
super.viewDidLoad()
keyboardObserver.onWillShow = { [weak self] info in
// Change a view according to keyboard size.
}
}
All six UIKeyboard notifications are implemented. You can use the following callbacks:
onWillShow
, onDidShow
, onWillHide
, onDidHide
, onWillChangeFrame
, onDidChangeFrame
Take a look at change log.
Use Swift Package Manager integration in Xcode to add this dependency.
Just drop the KeyboardNotificationsObserver.swift
file into your project. That's it!
KeyboardNotificationsObserver is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 5 |
Last commit: 4 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics