Giter VIP home page Giter VIP logo

keyboardlayoutguide's Introduction

⌨️ KeyboardLayoutGuide

Apple's missing KeyboardLayoutGuide

Language: Swift 5 Platform: iOS 9+ SPM 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:

Safe Area

By default, KeyboardLayoutGuide will align your item with the bottom safe area. This is a behaviour that can be opt out by using keyboardLayoutGuideNoSafeArea instead of keyboardLayoutGuide.

Installation

The Swift Package Manager (SPM) is now the official way to install KeyboardLayoutGuide. The other package managers are now deprecated as of 1.7.0 and won't be supported in future versions.

Swift Package Manager

Xcode > File > Swift Packages > Add Package Dependency... > Paste https://github.com/freshOS/KeyboardLayoutGuide

CocoaPods - Deprecated

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

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

Carthage - Deprecated

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.

keyboardlayoutguide's People

Contributors

ali312 avatar dstranz avatar efraimb avatar ezisazis avatar maxkonovalov avatar numen31337 avatar s4cha avatar senseiphonex avatar thomas-sivilay avatar xzeror avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.