freshos / keyboardlayoutguide Goto Github PK
View Code? Open in Web Editor NEW⌨️ KeyboardLayoutGuide, back from when it didn't exist.
License: MIT License
⌨️ KeyboardLayoutGuide, back from when it didn't exist.
License: MIT License
Hi. I have been using this library for every project I have worked on. Never really had a problem. However this last project we decided using SnapKit.
I have set this button to be aligned with the keyboard. Button does change its position when the keyboard is opened or closed but not along with the keyboard. It just changes its frame at a moment.
Does anyone have any suggestions?
Update to 4.2 please.
Currently, if the device is running iOS 11 or newer, the keyboardLayoutGuide.bottomAnchor
is always equal to the view's safeAreaLayoutGuide.bottomAnchor
.
Sometimes it is nice to be able to pin views to the bottom of the screen, instead of the bottom of the safe area. It would be nice if there was a setting or parameter for determining whether or not the keyboardLayoutGuide uses the safe area.
Layout guides are not updated if dismiss mode is interactive, is there a way to fix this?
Great idea for a library.
It works great with the exception that it seems to add an extra safe area to the height of the guide when the keyboard is opened. I think it's because the height in the keyboard notification event takes the safe area into account. Am I understanding safe area wrong?
Hello,
First of all congrats for the lightweight and great implementation. It's the best i've seen so far.
There is a bug where when switching the first responder from a normal textfield to a secured textfield, a weird animation is performed. This is cause because for some reason the keyboardWillChangeFrame notification is called not once but three times, the first one being a weird value. In order to fix this, we just have to perform the change animated only when the duration specified in the notification is greater than 0.
Here is a screen recording of the bug: https://my.pcloud.com/publink/show?code=XZO6ibkZ92g9nOy76gbtm7VTohGNg0GDcq27
It appears to officially support keyboardLayoutGuide from iOS15+.
view.keyboardLayoutGuide causes errors 'keyboardLayoutGuide' is only available in iOS 15.0 or newer
Reference: https://developer.apple.com/documentation/uikit/uiview/3752221-keyboardlayoutguide
There are cases, when keyboard doesn't intersect view controller's view: e.g. view controller is shown modally with modalPresentationStyle == .formSheet on iPad, however keyboardLayoutGuide is shrinked by the height of the keyboard.
Notification.keyboardHeight == screenHeight
when you move the floating keyboard
This is a very handy framework!
Currently keyboardLayoutGuide
automatically pins to safeAreaLayoutGuide.bottom
.
There is a way to disable it getting a pointer to keyboardLayoutGuide
and setting its usesSafeArea
property to usesSafeArea
.
There are two cases:
keyboardLayoutGuide
, one taking safeArea
into account, the second doesn't — keyboardLayoutGuide
is a single instance property.let keyboardLayoutGuide = view.keyboardLayoutGuide // we don't know about the implementation, so we're holding a reference here
keyboardLayoutGuide.usesSafeArea = false
pinnedView.bottomAnchor.constraint(equalTo: keyboardLayoutGuide.topAnchor).isActive = true
I prefer one from the following:
keyboardLayoutGuide
with usesSafeArea = false
pinnedView.bottomAnchor.constraint(equalTo: keyboardLayoutGuide.topAnchor).isActive = true
pinnedView.bottomAnchor.constraint(equalTo: keyboardLayoutGuideNoSafeArea.topAnchor).isActive = true
KeyboardLayoutGuide
with usesSafeArea
turned offpinnedView.bottomAnchor.constraint(equalTo: keyboardLayoutGuide.topAnchor).isActive = true
pinnedView.bottomAnchor.constraint(equalTo: keyboardLayoutGuide.topAnchor).isActive = true
pinnedView.bottomAnchor.constraint(equalTo: keyboardLayoutGuide.noSafeArea.topAnchor).isActive = true
Achievable via extension like:
public extension KeyboardLayoutGuide {
var noSafeArea: KeyboardLayoutGuide {
self.usesSafeArea = false
return self
}
}
There's no pod specification for pod 'Keyboard+LayoutGuide'.
When building an app with KeyboardLayoutGuide from Swift Package Manager in Xcode 13 beta 3 that does not use app extensions, compiler errors related to API availability in app extensions are emitted.
Result: multiple errors on UIApplication.shared
usage:
'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.
This appears to be expected behavior in Xcode 13 beta 3 with Swift Package Manager, based on this Apple Developer Forums thread and this Swift forums post. The Apple engineer in the second link recommends dealing with this by marking declarations as unavailable to app extensions when they use APIs that are unavailable to app extensions.
Update: It looks like the Swift team is reconsidering how this behaves. I'll update this issue as we hear more from them.
The constraint is set but updated incorrectly in an MSMessagesAppViewController
.
On iOS 12, the interactive keyboard dismissal in a scroll view does not fire the keyboardWillChangeFrameNotification
until the pan gesture ends, so any views constrained to keyboardLayoutGuide.topAnchor
remain static throughout the interactive part of the animation.
I am not sure if this worked properly prior to iOS 12.
Hi,
firstly, thanks for great library!
I have one question - is it possible to bring back support for other dependency managers? SPM is great and all, but it is not yet suitable for all use cases (e.g. libraries with mixed Swift/Obj-C or with resources). Because of that, lots of projects can't switch to it yet and potentially having two dependency managers (e.g. Cocoapods + SPM) might do more harm than good (e.g. resolving some subdependencies) and confuse other developers.
If that's not something you want to do, then I think it would be good idea to remove Carthage and Cocoapods badges from README
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.