← Back to list

KeyboardLayoutGuide in iOS15*

Apple says A layout guide that tracks the keyboard’s position in your app’s layout.

Pawan Manjani · 2023-09-24 16:05 · 17 claps · 1.4 min read
#keyboardlayoutguide #swift #ios #keyboard #ios15
Open on Medium ↗
Wiki topics: 📱 · Mobile Development

KeyboardLayoutGuide in iOS15*

Apple says A layout guide that tracks the keyboard’s position in your app’s layout.

In simple words KeyboardLayoutGuide help us to setup view frame according to the keyboard position when keyboard appears in the screen.

Before iOS15 we use to import IQKeyboardManager in our project to adjust our view when keyboard appears in our application’s view and it’s very wonderful library to use or we used to manually set up a NotificationCenter to adjust our view when keyboard appears. But now we have KeyboardLayoutGuide to help us here.

Let me show you an example

yourView.bottomAnchor.constraint(equalTo: self.view.keyboardLayoutGuide.bottomAnchor).isActive = true

In above code we given bottomAnchor of our view constraint to keyboardLayoutGuide’s bottomAnchor and just it.

Source https://gifer.com

Source https://gifer.com

What if I want to use in storyboard?

  1. Select your main view and go to size inspector and then select Keyboard checkbox
  2. Give your view’s bottom constraint to KeyboardLayoutGuide’s top

Just it!

For more visit: https://ioslifee.blogspot.com

Thanks for reading, Happy Coding 💻


메타데이터
post_id
8a47ed93ba96
slug
keyboardlayoutguide-in-ios15-8a47ed93ba96
url
https://medium.com/@manjani-pavan/keyboardlayoutguide-in-ios15-8a47ed93ba96
canonical_url
https://medium.com/@manjani-pavan/keyboardlayoutguide-in-ios15-8a47ed93ba96
author_url
https://medium.com/@manjani-pavan
status
ok
fetched_at
2026-07-25 05:01:28