I'm making a custom keyboard with an UIInputViewController.
I want to display a xib layout inside a rect. Right now, I determine the correct size of the CGRect, in which I place my xib layout, from UIScreen.main.bounds
. However, UIScrren.main.bounds.width
is longer than the safe area width when I rotate the iPhone 11 to landscape orientation. As a result, my rect is too wide and part of it is not displayed.
iphone11 screen
How can I determine safe bounds? I would like to replace UIScreen.main.bounds
with something like UIScreen.main.safeArea
but it seems like I have to do something more complicated than that.
Should I just use UIScreen.main.nativeBounds
? If so, I'm not sure how to convert from pixels to points.