When using storyboards and adding constraints that are installed with Size Class wR hR
, the proper constraints are not being applied when building on iPad Simulator or real device. Only the constraints that are installed with wC hR
are being applied.
This issue happens on Xcode 16 & Xcode 16.1, but does not occur in Xcode 15 versions. To help verify I've created a sample project and am able to re-create the issue there.
I've also filed feedback to Apple about this (FB15647804) and included the below steps to re-create using that sample project, but they have yet to respond.
Steps to Reproduce:
- Run linked Xcode project
SizingClassTest
from this public git repo: https://github.com/bmjohns/SizingClassTest which has 1 label that has a constraint installed withwC hR
and another installed withwR hR
- Build on iPad 18+ simulator
- Select button to view page with label that has size class constraints
- View that label is appearing at top of view, where it should be appearing at bottom (per storyboard)
- Run on iPhone simulator 18+, view that label is appearing at top as expected
Can anyone help confirm if this issue also happens to them?
I do have some findings since my last post (but no responses on Apple Feedback where I also posted this).
wR, hR
). Removing that resolved most of the issues. traitOverrides.horizontalSizeClass = .compact
ViewController
. If you present automatically
or in a not full page way (ie full screen
) then the size class wR, hR
will not be applied. I believe there is still a bug in Xcode 16 where the GUI of storyboard will not show this distinction, but only during runtime on sim or device. If you take my sample project and change the presentation style of the second VC with the label to full screen
it will properly apply the wR, hR
on build