Clavier is available under the MIT license. See the LICENSE file for more info.
Basic Usage
Clavier is the Keyboard Layout Guide created to make constraints to the keyboard. It will automatically change on the keyboard changes. It calculates the intersection frame of the Keyboard and the UIView. As you can see in the picture below:
If the keyboard did not intersect with the view, it will always use the most bottom of the UIView with zero height for the regular one, or most bottom of the safe area when using a safe one
If the keyboard is hidden, it will always use the most bottom of the UIView with zero height for the regular one, or most bottom of the safe area when using a safe one
Usage
To use Clavier, just use clavierLayoutGuide from any UIView, or safeClavierLayoutGuide if you prefer the one intersect with the safe area. it is an instance of ClavierLayoutGuide class which extend UILayoutGuide so it has all its anchors, like topAnchor, leadingAnchor, etc:
myView will automatically move according to keyboard layout guide frame changes.
Since its subclass of UILayoutGuide, it has layoutFrame which is the intersection frame with keyboard frame, if you need it:
let frameIntersectWithKeyboard: CGRect = view.clavierLayoutGuide.layoutFrame
or with safe area:
let frameIntersectWithKeyboard: CGRect = view.safeClavierLayoutGuide.layoutFrame
iOS 15
On iOS 15, Clavier will defaultly use keyboardLayoutGuide from UIKit. on safeClavierLayoutGuide, it will use custom class that utilize keyboardLayoutGuide and safeAreaLayoutGuide
You can explicitly disable iOS 15 keyboardLayoutGuide if you want by set directly with the view or by using global config.
myView.usingAppleKeyboardLayoutGuideIfAvailable = false
// or to apply as default with all view
ClavierGlobalConfig.usingAppleKeyboardLayoutGuideIfAvailable = false
Clavier
Clavier is Keyboard Layout Guide for iOS. It using an intersection frame to calculate the Layout Guide.
Example
To run the example project, clone the repo, and run
pod install
from the Example directory first.Requirements
Installation
Requirements
Cocoapods
Clavier is available through CocoaPods. To install it, simply add the following line to your Podfile:
Swift Package Manager from XCode
Swift Package Manager from Package.swift
Add as your target dependency in Package.swift
Use it in your target as
Clavier
Author
Nayanda Haberty, hainayanda@outlook.com
License
Clavier is available under the MIT license. See the LICENSE file for more info.
Basic Usage
Clavier is the Keyboard Layout Guide created to make constraints to the keyboard. It will automatically change on the keyboard changes. It calculates the intersection frame of the Keyboard and the
UIView
. As you can see in the picture below:If the keyboard did not intersect with the view, it will always use the most bottom of the
UIView
with zero height for the regular one, or most bottom of the safe area when using a safe oneIf the keyboard is hidden, it will always use the most bottom of the UIView with zero height for the regular one, or most bottom of the safe area when using a safe one
Usage
To use Clavier, just use
clavierLayoutGuide
from anyUIView
, orsafeClavierLayoutGuide
if you prefer the one intersect with the safe area. it is an instance ofClavierLayoutGuide
class which extendUILayoutGuide
so it has all its anchors, liketopAnchor
,leadingAnchor
, etc:or with safe area:
myView will automatically move according to keyboard layout guide frame changes.
Since its subclass of UILayoutGuide, it has layoutFrame which is the intersection frame with keyboard frame, if you need it:
or with safe area:
iOS 15
On iOS 15, Clavier will defaultly use
keyboardLayoutGuide
from UIKit. onsafeClavierLayoutGuide
, it will use custom class that utilizekeyboardLayoutGuide
andsafeAreaLayoutGuide
You can explicitly disable iOS 15
keyboardLayoutGuide
if you want by set directly with the view or by using global config.Contribute
You know how, just clone and do pull request