Horizontal Size Classes on iPhone in iOS 27

In iOS 27, willTransition(to:with:), registerForTraitChanges(), and other mechanisms to monitor size classes do not change when an iPhone interface is resized. Only viewWillTransition(to:with:) is invoked with a new size. And this only happens on the iPhone: the iPad continues to work as it has in the past.

It appears that this is intended behavior. That is not to say that it's intuitive behavior.

Many experienced developers are encountering the "horizontal size is always compact" behavior and immediately thinking "this must be a beta bug":

https://fatbobman.com/en/posts/from-size-class-to-available-space/

But it's not.

I get that the new size class behavior is expressing static device semantics and is no longer a dynamic size indicator. The problem is that the tools we have been using to build layouts for the past decade use size classes as dynamic sizing indicators.

Storyboards can contain variations that specify whether a constraint is used for regular or compact widths/ heights. Developers have used this ability to automatically adjust layouts as the size classes change.

In one case, I use this capability to adjust a top-over-bottom layout in a portrait configuration to a side-by-side in a landscape configuration: switching centering, leading/trailing, and aspect ratios to fit the available size. I suspect that many developers who have taken the time to create a unique layout for an iPad are doing something similar.

(Ironically, the folks who treated an iPad as a big iPhone are the ones least affected by this change.)

When iPadOS got the ability to resize interfaces (as UIScene windows), I made sure that the automatic size class contraints worked correctly and made adjustments as necessary. That work now has to be discarded and switched over to something more universal.

If this is truly the intended behavior going forward, time needs to be invested in updating the tooling behind automatic constraint variations:

  • There should be warnings when the storyboard is compiled. I have dozens of automatic contraints embedded in the storyboard: and they're hard to find (each subview has its own contraints, so it's a manual traversal of a huge tree).
  • There should be runtime warnings that your code that inspects size classes won't be executed. This was the biggest "what the hell is going on?" when trying to resize the interface the first time.

At a higher level, Apple engineers have described what is happening. They have not explained why the iPhone is behaving differently than an iPad. And that's the root of this whole situation being unintuitive. We've got no clue.

And developers without a clue are unlikely to adopt a new technology. It's essential that Apple explains this change in more detail. Yes, you're going to have to obfuscate it and make us read between the lines, but it's got to be done. (Everyone understands the changes regarding mainScreen wink wink, for example.)

A reply in this thread would be a good place to start this explanation.

Many experienced developers are encountering the "horizontal size is always compact" behavior and immediately thinking "this must be a beta bug". But it's not.

The size class in iPhone mirroring should update when you resize the device, very similar to what you would see on iPad. We do not make any guarantee on the exact pixel values where that happens as that may change based on the device you are running on, but you should still see the size class updating as the screen grows larger.

If this is not happening, please file feedback, ideally with a sample project attached.

I just submitted a simple project with FB23422375 that demonstrates the issue.

For everyone else following along, here is a ZIP file that contains the project:

https://files.iconfactory.net/craig/bugs/Resizer.zip

And the steps to reproduce the issue:

  1. Open the attached project (Resizer.zip) in Xcode 27.0 beta 2 (27A5209h)
  2. Build & run the project in Device Hub Version 27.0 (244.2.3) using an iPhone 17 device
  3. Enter resize mode
  4. Resize the interface to 1280 x 960

Expected results:

The NSAssert at line 31 or line 71 should fire because the horizontal size class is larger than compact.

Actual results:

The NSAssert never fires because the horizontal size class is always compact.

Note:

This behavior does not occur on the iPad: the asserts fire because the size class changes as the window is resized.

Apple always seemed very stingy with regular size classes on iPhone as a way to differentiate the smaller and larger phone models

Even when the smaller models became as large as previous large models Apple restricts them in software from showing UI elements like sidebars.

I suspect some of that is going on here as well.

https://www.reddit.com/r/ios/comments/1rh2vlk/ios_landscape_ui/

Horizontal Size Classes on iPhone in iOS 27
 
 
Q