Latest 1.0.0
Homepage https://github.com/yagiz/KeyboardDismisser
License MIT
Platforms ios 9.0
Authors

KeyboardDismisser is a little Swift 4.x pod that adds a button over keyboard so that users can dismiss keyboard easily.

Preview

KeyboardDismisser

Installation

CocoaPods

pod 'KeyboardDismisser'

Manually

Just download or clone the repo and move Classes folder to your project.

Usage

Call attach() method of singleton KeyboardDismisser instance in AppDelegate.swift or in any other root class you have.


import UIKit
import KeyboardDismisser

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        KeyboardDismisser.shared.attach()

        return true
    }
}

Customizing Dismissing Button

You can change the button image, size or margins. You should do any customisation before calling attach() method.

import UIKit
import KeyboardDismisser

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        KeyboardDismisser.shared.buttonImage = "keyboardDismissIcon.png"
        KeyboardDismisser.shared.buttonSize = CGSize(width: 30, height: 30)
        KeyboardDismisser.shared.buttonRightMargin = 10
        KeyboardDismisser.shared.buttonBottomMargin = 10

        KeyboardDismisser.shared.attach()

        return true
    }
}

Disabling/Enabling

In some cases you may want to disable KeyboardDismisser. For example if you add custom textfield accessories you may want to disable it. To do so you can use isDisabled property.

KeyboardDismisser.shared.isDisabled = true

License

MIT

Free Software, Hell Yeah!

Latest podspec

{
    "name": "KeyboardDismisser",
    "version": "1.0.0",
    "summary": "KeyboardDismisser is a little Swift 4.x pod that adds a button that can dismiss keyboard",
    "description": "KeyboardDismisser is a little Swift 4.x pod that adds a button that can dismiss keyboard. Button image, size and margin are all customizable.",
    "homepage": "https://github.com/yagiz/KeyboardDismisser",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Yagiz": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yagiz/KeyboardDismisser.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Classes/**/*.{swift,xib,png}"
}

Pin It on Pinterest

Share This