Latest 1.2
License MIT
Platforms ios 9.0

KeyboardNotification protocol helps to get Keyboard event like Show / Hide / Frame Changes along with keyboard frame and size.



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate KeyboardNotification into your Xcode project using CocoaPods, specify it in your Podfile:

target '<Your Target Name>' do
    pod 'KeyboardNotification'

Then, run the following command:

$ pod install

How to Use

It is very simple and easy to use. Just adopt KeyboardNotification protocol to your Controller class or any class. It will ask yoou declar a varibale keyboardTokens.

class ViewController: UIViewController, KeyboardNotification {
    var keyboardTokens: [NSObjectProtocol]?

Register Object

You need to register your class for keyboard notification just by calling.


Note: Once you register the object, then you must need to deregister you object.

Deregister Object

If your no more interested to handle notification you should deregister your object like


Impleting Protocol

Once you register the object, you can automatically get all notification mentioned below. Aslo you can access keyboardFrame and keyboardSize directly from notification object.

    func willShowKeyboard(_ note: Notification)
    func didShowKeyboard(_ note: Notification)
    func willHideKeyboard(_ note: Notification)
    func didHideKeyboard(_ note: Notification)
    func willChangeKeyboardFrame(_ note: Notification)
    func didChangeKeyboardFrame(_ note: Notification)


extension ViewController {

    func willShowKeyboard(_ note: Notification) {

        let frame = note.keyboardFrame

    func didHideKeyboard(_ note: Notification) {

        let size = note.keyboardSize   


For more details check for sample project.



Latest podspec

    "name": "KeyboardNotification",
    "version": "1.2",
    "summary": "KeyboardNotification protocol help you to manage Keyboard notification and more",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Swifty-iOS": "[email protected]"
    "platforms": {
        "ios": "9.0"
    "source": {
        "git": "",
        "tag": "1.2"
    "source_files": "Source/*.swift",
    "pushed_with_swift_version": "4.0"

Pin It on Pinterest

Share This