⌨️ Apple's missing KeyboardLayoutGuide
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Images Updates gif Dec 4, 2017
KeyboardLayoutGuide Finish Migrating to swift 4.2 (v1.3.0) Sep 18, 2018
KeyboardLayoutGuideExample Finish Migrating to swift 4.2 (v1.3.0) Sep 18, 2018
.gitignore Initial commit Nov 14, 2017
.swift-version Updates `.swift-version` file Sep 18, 2018
Keyboard+LayoutGuide.podspec Finish Migrating to swift 4.2 (v1.3.0) Sep 18, 2018
KeyboardLayoutGuide.framework.zip Finish Migrating to swift 4.2 (v1.3.0) Sep 18, 2018
LICENSE Initial commit Nov 14, 2017
README.md

README.md

⌨️ KeyboardLayoutGuide

Apple's missing KeyboardLayoutGuide

Language: Swift 4 Platform: iOS 9+ Carthage compatible CocoaPods compatible Build Status codebeat badge License: MIT GitHub tag

  • No Subclassing / Protocol inheritance / obscure overrides
  • No more keyboard notification handling
  • UIKit Friendly
  • Takes safeArea into account
  • Only animates if view is fully on screen

How to use it

Simply constrain your views to the KeyboardLayoutGuide's top anchor the way you would do natively:

override func viewDidLoad() {
    super.viewDidLoad()

    // Pin your button to the keyboard
    button.bottomAnchor.constraint(equalTo: view.keyboardLayoutGuide.topAnchor).isActive = true
}

Bonus: if you're using Stevia, this gets even more concise \o/

button.Bottom == view.keyboardLayoutGuide.Top

If you add your view in Interface Builder, don't forget to enable the "Remove at build time" checkbox for the bottom constraint:

Installation

CocoaPods

To install KeyboardLayoutGuide via CocoaPods, add the following line to your Podfile:

target 'MyAppName' do
  pod 'Keyboard+LayoutGuide'
  use_frameworks!
end

Carthage

To install KeyboardLayoutGuide via Carthage, add the following line to your Cartfile:

github "freshos/KeyboardLayoutGuide"

Manually

Just add Keyboard+LayoutGuide.swift to your Xcode project.

License

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