Skip to content
iPhone Duo SupportGet help

Drive layout from size classes, not device idiom

Blockerlayout

What you see

The app shows its cramped iPhone layout on a 7.6-inch display with room for a sidebar, wasting most of the screen.

UIUserInterfaceIdiom.phone used to be a reliable shorthand for “small screen, one column, no sidebar”. iPhone Duo makes that shorthand false: it reports the phone idiom while offering a regular-width display with room for a sidebar.

Why it happens

Idiom answers what kind of device is this. Layout needs to know how much space do I have. Those were correlated for a decade, so the first became a proxy for the second. iPhone Duo decouples them, and every layout decision built on the proxy now produces an iPhone-shaped UI on a display large enough for an iPad-shaped one.

The fix

Read size classes, which describe available space directly:

// SwiftUI
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@Environment(\.verticalSizeClass)   private var verticalSizeClass
// UIKit
traitCollection.horizontalSizeClass
traitCollection.verticalSizeClass

What to expect on this device:

Because the inner display is regular-width, the same branch that already produces your iPad layout is usually the right one to reuse. Apps with an existing iPad target often have most of this work done.

Avoid the temptation to write if idiom == .pad || isDuo. Detecting a specific device reintroduces exactly the assumption that broke here, and it will break again on the next form factor. Branch on space, not on hardware.

How to verify

Log both size classes as you fold, unfold, rotate, and enter Split View. Confirm your layout branches on those values and that no branch is reachable only by an idiom check.

← All checksGet help with this