Latest 0.2.0
License MIT
Platforms ios 8.0


KeyboardAdjustable takes into account the three most common ways we adjust our view when the keyboard appears:

  • When you have a ScrollView and you want to change its contentInset when the keyboard appears
  • When you have a bottom constraint for a UIView and you want to change it’s value when the keyboard appears
  • When you have multiple constraints in your views and you want to change it’s values when the keyboard appears

With only one line of code you’ll be able to handle these scenarios without having to implement the keyboard observers in your own UIViewController.

How to use:

  1. Import KeyboardAdjustable on your UIViewController file
  2. Add the KeyboardAdjustable protocol to your UIViewController
  3. Setup a KeyboardAdjustingStrategy on your viewDidLoad

Make sure you’re calling registerForKeyboardNotifications() on your viewDidLoad and unregisterForKeyboardNotifications() on your viewDidDisappear.


class SingleConstraintViewController: UIViewController, KeyboardAdjustable {

    var keyboardAdjustingStrategy: KeyboardAdjustingStrategy?

    @IBOutlet weak var bottomConstraint: NSLayoutConstraint!

    override func viewDidLoad() {

        // Register for keyboard notifications

        // Set your desired strategy to adjust the view when the keyboard appears
        self.keyboardAdjustingStrategy = .singleConstraint(
                                          constraint: bottomConstraint, 
                                          originalConstant: bottomConstraint.constant,
                                          spaceAboveKeyboard: 20)

    override func viewDidDisappear(_ animated: Bool) {
        // Unregister for keyboard notifications

This Pod also has an example project

To run the example project, clone the repo, and run pod install from the Example directory first.


With a ScrollView:

With a Single Constraint:

With Multiple Constraints:


Swift 4.2


KeyboardAdjustable is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'KeyboardAdjustable'

If you’re having issues with the command above, try running pod repo update then try again


Cesar Bess, [email protected]


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

Latest podspec

    "name": "KeyboardAdjustable",
    "version": "0.2.0",
    "summary": "A short and descriptive way to adjust your view when the keyboard appears",
    "description": "'Adjusting your view for when the keyboard appears has never been easier. With 3 lines of code you will be listening to keyboard notifications and adjusting your view.'",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Cesar Bess": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.2.0"
    "platforms": {
        "ios": "8.0"
    "swift_version": "4.2",
    "source_files": "KeyboardAdjustable/Classes/**/*"

Pin It on Pinterest

Share This