UIKit · class
UIArrangementViewController
Lays out a main and a secondary view across every iPhone Duo pose, taking size classes, aspect ratio and active division regions as input.
UIArrangementViewController takes two related views — a main one and a
secondary one — and places them correctly for whatever pose the device is
in, without you writing a layout branch per pose.
It is the UIKit half of a pair. The SwiftUI spelling is ArrangementView, and
the two do the same job.
What it takes into account
You hand it the content; it reads the environment. The inputs are the size classes, the aspect ratio of the space it has, and any active division region — the strip the hinge occupies when the device is partially folded. That last one is why hand-rolled split layouts go wrong: they place a divider at 50% and the hinge is somewhere else.
Two styles
- Split — the two views sit side by side, or stacked, with the arrangement choosing which.
- Overlay — the secondary view floats above the main one.
overlayArrangementZIndexcontrols which is on top.
The mistake worth naming
Reaching for the hinge angle to decide the layout. onHingeChange and
UIHingeInteraction report an angle, and it
is tempting to drive frames from it. Apple is explicit that the angle is for
effects, not for layout — and an arrangement already handles the poses
that angle was standing in for.
Not to be confused with
UISplitViewController, which is about a navigation hierarchy on a wide
screen. An arrangement is about two pieces of content sharing a space that
changes shape while the app is open.
Doing the work
This page describes the symbol. For what to change in an app that does not use it yet, and how urgent that is, see adopt ArrangementView for main-and-secondary layouts.