यह लेख अभी हिन्दी में उपलब्ध नहीं है, इसलिए इसे अंग्रेज़ी में दिखाया जा रहा है।
iPhone Duo SwiftUI Tutorial: Build Adaptive Apps for a Foldable Screen
Get a SwiftUI app ready for iPhone Duo: size classes, asymmetric safe areas, side tab bars, reserved regions for the fold and the new ArrangementView.
One line of SwiftUI can break an app on iPhone Duo:
.frame(width: 390)That line was fine on every iPhone ever made. On a phone that unfolds, your app sits in a narrow strip with dead space on both sides.
This guide follows Apple's six developer sessions and its design page for iPhone Duo, published September 9, 2026. One honest note: nobody could record an iPhone Duo simulator when I made the video, so the previews there are drawn to match what the layout does. The API names below are Apple's. Check the exact signatures in Apple's documentation before you ship.
▶ WATCH ON YOUTUBEWatch the video
▶ WATCH ON YOUTUBEFull video
The mental model
- The outer display is a compact width environment.
- The inner display is a regular width environment.
That is the whole model. Not six layouts for six poses. One layout that grows into the space it is given. Your app can also share the inner display with another app, so it will see many widths.
A ten-minute audit
Search your project for five things:
- Fixed widths.
UIScreen.main. With two displays, "the main screen" is not a safe idea.- Orientation checks. Branching on portrait or landscape will guess wrong.
- Safe-area maths that assumes the left inset equals the right one.
- Run it, resize the window and watch what breaks.
Free win: build against the latest SDK so your app uses the full screen, not a compatibility mode. Xcode 27.1's Device Hub simulates every pose.
Ask for the size class, not the orientation
Orientation tells you how the device is turned. It does not tell you how much room your app got.
@Environment(\.horizontalSizeClass) private var sizeClass
var columns: Int { sizeClass == .regular ? 2 : 1 }Closed, you get one column. Open, the same code gives two. In UIKit, ask traitCollection.horizontalSizeClass.
Use standard containers
Apple's rule: do not reinvent your app when it resizes. Mail shows a list when closed, and a list plus a message when open. A NavigationSplitView does this for you. It collapses to one pane when closed and expands to two when open, and it adjusts the pane widths around the fold.
Stop assuming one screen
- Read the screen from the window scene:
window?.windowScene?.screen. - For image scale, use
traitCollection.displayScale, so thumbnails stay sharp on both displays.
In most apps this is a handful of lines.
Safe areas are lopsided now
On Duo the system puts controls along one edge, so the left and right insets differ. Do not take one inset and double it.
let content = view.bounds.inset(by: view.safeAreaInsets)Backgrounds are the exception. A background should ignore the safe area and fill everything.
Bars move to the side
The outer display is wider and shorter than a normal iPhone, so the system moves toolbars and tab bars to the side to save height. A standard TabView does this with one modifier, .defaultTabBarPlacement(.sidebar).
Your real job is deciding what survives when the bar runs out of room:
- Give key actions a
.visibilityPriority(_:). The rest go to the system overflow menu. - Navigation-focused app: keep the tab bar and let toolbar items overflow.
- Task-focused app: minimise the tab bar and keep the actions.
- Group items with
ToolbarItemGroup, and give every item a title as well as a symbol.
Reserved regions: cameras and the fold
Parts of the display are already taken.
| Region | Behaviour |
|---|---|
| Outer camera | Always there, expands into the Dynamic Island |
| Inner camera | Behind the display, only present while the camera is active |
| Folding region | When half open, the fold splits the inner display into two usable areas |
Ask where they are with proxy.reservedRegions(kind: .division) for the hinge and kind: .occlusion for the camera. You get frames back and move content out of them. Pass options: .includeInactive to also get regions that are not there yet, so the layout does not jump when someone folds the phone.
Most of the time you will not need this. Alerts, menus, sheets and split views move themselves. In a grid, prefer an even number of columns so content divides cleanly at the fold.
ArrangementView
An arrangement view holds a primary and a secondary view and arranges them by size, orientation and reserved regions.
| Style | Behaviour | Use it when your layout is |
|---|---|---|
.arrangementViewStyle(.split) |
The two views divide the space. Half open, each takes one side of the crease | An HStack or VStack |
.arrangementViewStyle(.overlay) |
The secondary sits on top, like a mini player. When folded they move apart | A ZStack |
A view can react to being covered by reading @Environment(\.overlayArrangementZIndex). UIKit has UIArrangementViewController. Keep navigation stacks and tab views outside the arrangement.
Hinge angle
You can observe hinge angle changes. Use the hinge for interactive effects. Use size classes and reserved regions for layout. Do not mix them up.
Five things Apple says not to do
- Do not rearrange your interface as the device folds. Move only what must move.
- Games: do not letterbox. Fill the screen in every pose.
- Do not override the default bar placement.
- Move a custom overflow menu into the system one.
- Avoid odd column counts in grids.
Week-one checklist
- Build with the latest SDK.
- Remove fixed widths and
UIScreen.main. - Replace orientation checks with size classes.
- Handle each safe-area edge on its own.
- Resize your app and test every pose in Device Hub.
iPhone Duo does not make iOS development harder. It makes the shortcuts we all took visible.
Links
- Full video: https://youtu.be/YqAPF82GF3Y
- Get ready for iPhone Duo: https://developer.apple.com/iphone-duo/
- Designing for iPhone Duo: https://developer.apple.com/design/human-interface-guidelines/designing-for-iphone-duo
- SwiftUI documentation: https://developer.apple.com/documentation/swiftui
- The phone itself: iPhone Duo explained
Which part of your app worries you most: navigation, safe areas or the fold?


