I started adapting my app for iPhone X and found an issue in Interface Builder.
The safe area layout guides are supposed to be backwards compatible, according to official Apple videos. I found that it works just fine in storyboards.
But in my XIB files, the layout guides are not respected in iOS 10.
They work fine for the new OS version, but the iOS 10 devices seem to simply assume the safe area distance as zero (ignoring the status bar size).
Am I missing any required configuration? Is it an Xcode bug, and if so, any known workarounds?
Here is a screenshot of the issue in a test project (left iOS 10, right iOS 11):
Hi Tiago and Aximem63,
Thank you for the question. We have a radar tracking this issue 34477706.
In the current Xib backwards deployment behavior (iOS 10 and prior), a constraint to the safe area will be converted to the superview, because a XIB does not have top and bottom layout guides.
This may not achieve the layout behavior that you want, and we recommend you working around this case with one of the following options:
1) move the the view and layout to a storyboard view controller
2) use IB Outlets to the relevant (top and bottom) constraints, and programatically replace them with constraints to top/bottom layout guide once the view gets installed
3) install the view as a subview, and programmatically add constraints to top/bottom layout guides and sides.