Go to file
Aleksey Kuznetsov d825a8394b Prepare release 2019-09-22 10:38:21 +05:00
.swiftpm/xcode/package.xcworkspace Enable SwiftPM, reorganize project's structure 2019-09-21 22:14:02 +05:00
Example Update travis config 2019-09-22 10:20:44 +05:00
Sources/KeyboardNotificationsObserver Enable SwiftPM, reorganize project's structure 2019-09-21 22:14:02 +05:00
.gitignore Enable SwiftPM, reorganize project's structure 2019-09-21 22:14:02 +05:00
.travis.yml Update travis config 2019-09-22 10:20:44 +05:00
CHANGELOG.md Prepare release 2019-09-22 10:38:21 +05:00
LICENSE Update meta info and readme 2019-05-09 20:40:52 +05:00
Package.swift Enable SwiftPM, reorganize project's structure 2019-09-21 22:14:02 +05:00
README.md Remove mention of cocoapods in the readme 2019-09-22 10:05:26 +05:00
demo.gif Update meta info and readme 2019-05-09 20:40:52 +05:00

README.md

KeyboardNotificationsObserver

Build Status

An observer for UIKeyboard notifications that provides a safe and convenient interface.

Demo

Usage

  • Import module
import KeyboardNotificationsObserver
  • Create KeyboardNotificationsObserver instance as a property (for example on a view controller)
private let keyboardObserver = KeyboardNotificationsObserver()
  • Implement necessary callbacks
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

Requirements

  • iOS 9.0 or higher
  • Xcode 11 (swift 5.0) or higher

Changes

Take a look at change log.

Installation

SwiftPM

Use Swift Package Manager integration in Xcode to add this dependency.

Manual

Just drop the KeyboardNotificationsObserver.swift file into your project. That's it!

License

KeyboardNotificationsObserver is available under the MIT license. See the LICENSE file for more info.