Layout

Size classes, safe areas and standard containers

How size classes map to iPhone Duo’s outer and inner displays, how to handle asymmetric safe areas, and which UIKit and SwiftUI containers adapt automatically.

8 min readUpdated 4 sources

The fastest way to build a great iPhone Duo layout is to write less device-specific code. Size classes tell you how much room you have, safe areas tell you where controls belong, and standard system containers already know how to transition between the outer and inner displays.

Size classes on iPhone Duo

Display Horizontal Vertical Behaves like
Outer, portrait Compact Regular Standard iPhone in portrait
Outer, landscape Compact Compact Standard iPhone in landscape
Inner Regular Regular Enough room for a sidebar and detail view

Read size classes from the environment in SwiftUI or from traitCollection in UIKit:

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

// UIKit
traitCollection.horizontalSizeClass
traitCollection.verticalSizeClass

Two important implications:

  • Regular width no longer means iPad. On the unfolded inner display, your iPhone app receives the same regular/regular size classes your iPad layout was designed for. Apple recommends treating the inner display as a natural extension of your iPad layout — if you already have one, let it run.1
  • Size classes change mid-session. Opening or closing the phone triggers a trait update, not an app relaunch. In hybrid UIKit/SwiftUI apps, observe traits on both sides of UIHostingController and UIViewRepresentable so both frameworks stay in sync.4

If your UI works in landscape, enable landscape on the outer display too — Apple notes that users often prop the phone up like a tent.1

Lean on standard containers

System containers adapt across every pose without custom glue code:

  • Split views: NavigationSplitView and UISplitViewController collapse into a single navigation stack on the outer display and expand into side-by-side columns on the inner display.
  • Tab views: TabView and UITabBarController work across both screens and automatically rotate into the vertical bar when appropriate.
  • Navigation stacks: NavigationStack and UINavigationController adopt the new vertical bar layout automatically. See Vertical toolbars and tab bars.
  • Presentations: Sheets, popovers, context menus, and alerts reposition themselves automatically. On the inner display, sheets center by default, or you can request leading or trailing placement via presentationPlacement(_:) or preferredPlacement.1

If you want your tab bar to expand into a sidebar on the inner display, opt in explicitly:

// SwiftUI
TabView { /* ... */ }
    .defaultTabBarPlacement(.sidebar)

// UIKit
tabBarController.sidebar.preferredPlacement = .sidebar

Apple’s engineers note that .sidebarAdaptable tab views don’t switch to a sidebar on iOS unless you set this preference.3

Respect the safe area on each edge independently

On iPhone Duo, system bars sit outside the safe area and automatically stay clear of the status bar and front camera. Horizontal bars inset the top and bottom edges; vertical bars inset the leading or trailing edge.

  • Foreground content (controls and interactive views) should stay inside the safe area. SwiftUI does this by default; in UIKit, pin to safeAreaLayoutGuide or inset by safeAreaInsets.
  • Background content (like full-bleed media or canvases) can extend behind bars using .ignoresSafeArea() in SwiftUI or view.bounds in UIKit.

Watch out for symmetry assumptions. Safe areas and layout margins on iPhone Duo are frequently asymmetric — a vertical bar may sit on the left edge in landscape or Split View while the right edge has a much smaller inset.1

// Avoid: assumes left and right insets are identical
let width = view.bounds.width - view.safeAreaInsets.left * 2

// Prefer: inset using each edge's actual value
let width = view.bounds.inset(by: view.safeAreaInsets).width

To test asymmetric insets, open your app in Split View on the inner display in Device Hub and drag the window by its home indicator to the opposite side — vertical bars can appear on either edge.3

Match the display corners

iPhone Duo introduces new display corner radii.1 When drawing rounded cards or containers near the edge of the screen, use the concentric corner APIs introduced in iOS 26, which automatically match iPhone Duo’s hardware corners:

// SwiftUI
ConcentricRectangle()
    .fill(Color.green)
    .padding(8.0)
    .ignoresSafeArea()

// UIKit: UICornerConfiguration

When safe areas aren’t enough

If you build custom edge-to-edge chrome — such as a custom bottom sheet or floating bar — iOS 27.1 provides reserved regions that report the exact frames of the hinge and camera cutouts so your views can route around them.2 See Hinge, poses and adaptive layouts for details.

Keep accessibility intact

Make sure Dynamic Type scales cleanly in every pose. Non-scrolling layouts should reflow at accessibility text sizes rather than clamping the font size, and custom layouts that span the hinge may need explicit accessibility containers or sort priority hints so VoiceOver reads elements in a logical order.3 Standard containers handle this automatically.

Sources

  1. Tech Talk: Prepare your app for iPhone Duo
  2. Apple Developer: Prepare your app for iPhone Duo
  3. Apple Developer Forums: A summary of the iPhone Duo Group Lab
  4. WWDC26: Modernize your UIKit app