Latest 1.0.0
Homepage https://github.com/TradeMe/KeyboardDodger
License MIT
Platforms ios 8.0
Authors

KeyboardDodger

KeyboardDodger is an iOS cocoapod that uses a constraint to move a view out of the way of the on-screen keyboard.

Installation

pod 'KeyboardDodger', '~> 1.0'

Usage

KeyboardDodger attaches to a view and a constraint at the bottom of the view, and manipulates the constraint to keep it out of the way of the on-screen keyboard.

An example implementation:

class ViewController: UIViewController {

    var bottomConstraint: NSLayoutConstraint?

    var keyboardDodger: KeyboardDodger?

    override func viewDidLoad() {
        super.viewDidLoad()

        if let bottomConstraint = bottomConstraint {
            keyboardDodger = KeyboardDodger(view: view, constraint: bottomConstraint, delegate: self)
        }
    }

}

extension ViewController: KeyboardDodgerDelegate {

    func keyboardDodger(_ keyboardDodger: KeyboardDodger, willUpdateConstraintWith transition: KeyboardDodgerTransition) {
        print("Keyboard dodger will update constraint")
    }

    func keyboardDodger(_ keyboardDodger: KeyboardDodger, didUpdateConstraintWith transition: KeyboardDodgerTransition) {
        print("Keyboard dodger did update constraint")
    }

    func keyboardDodger(_ keyboardDodger: KeyboardDodger, willResetConstraintWith transition: KeyboardDodgerTransition) {
        print("Keyboard dodger will reset constraint")
    }

    func keyboardDodger(_ keyboardDodger: KeyboardDodger, didResetConstraintWith transition: KeyboardDodgerTransition) {
        print("Keyboard dodger did reset constraint")
    }

}

Latest podspec

{
    "name": "KeyboardDodger",
    "version": "1.0.0",
    "summary": "KeyboardDodger uses a constraint to move a view out of the way of the on-screen keyboard.",
    "homepage": "https://github.com/TradeMe/KeyboardDodger",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Daniel Clelland": "[email protected]"
    },
    "source": {
        "git": "https://github.com/TradeMe/KeyboardDodger.git",
        "tag": "1.0.0"
    },
    "source_files": "Sources/*.swift",
    "platforms": {
        "ios": "8.0"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This