Swiftpack.co - zummenix/KeyboardNotificationsObserver as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by zummenix.
zummenix/KeyboardNotificationsObserver 1.0.0
An observer of `UIKeyboard` notifications.
⭐️ 5
🕓 4 years ago
iOS
.package(url: "https://github.com/zummenix/KeyboardNotificationsObserver.git", from: "1.0.0")

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.

GitHub

link
Stars: 5
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics