BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News What iOS Developers Need to Change in their Apps to prepare for the iPhone Duo

What iOS Developers Need to Change in their Apps to prepare for the iPhone Duo

Listen to this article -  0:00

With the upcoming introduction of the foldable iPhone Duo, iOS developers will need to adapt their apps to ensure they work correctly across the new device's outer display, larger inner display, and partially folded states. Developers will also need to account changes to navigation and toolbars, camera behavior, and new reserved regions.

To take full advantage of all the available screen space on iPhone Duo, developers should use Xcode 27.1. Apps built using previous versions of Xcode do not extend beneath the status bar and camera areas.

Because iPhone Duo supports multiple screen sizes, layouts, and orientations, your app needs to adapt gracefully across all of them. Check how your app appears on both displays, when closed, open, or partially folded. Rotate iPhone Duo in each pose to see how your apps layout reacts.

For an app to work properly on iPhone Duo, developers should avoid relying on fixed iPhone screen dimensions, such as UIScreen.main.bounds. Instead, views should be sized relative to their containers. Apple recommends using standard layout containers, including SwiftUI stacks, navigation, and split views, standard tab bars, and UIKit Auto Layout. This approach ensures that all views adapt automatically to changes in available space, whether the device is using the outer display, the fully open inner display, or a partially folded configuration with camera occlusions.

Furthermore, Apple also discourages developers from basing layout decisions on userInterfaceIdiom or UIInterfaceOrientation. Rather, apps should rely on size classes, that is observing horizontalSizeClass and verticalSizeClass changes to adapt the app UI to different sizes.

A major change in the iPhone Duo's UI is the positioning of toolbars and navigation bars, which may appear vertically on the side of the display in some poses. Apps using custom navigation or toolbars created using UIToolbar, UINavigationBar, or UITabBar may not adapt properly. In such cases, Apple recommends using standard navigation and toolbar APIs: adding the toolbar(content:) modifier to a NavigationStack or NavigationSplitView in SwiftUI, and setting toolbar items on a view controller added to a navigation controller in UIKit.

As mentioned, iPhone Duo also introduces new reserved regions, which correspond to the screen fold dividing the display into separate areas and to areas where a hardware element, such as the camera, occlude the app's content.

While framework-provided views and containers automatically adjust to work around the fold or the front-facing camera on the inner display, your custom views need a flexible approach to identify divisions and occlusions. [...] The inner front-facing camera can block your view when it's active, and the outer front-facing camera always occludes your view.

Developers can retrieve all reserved regions using reservedRegions(kind:options:layoutDirectionBehavior:) in SwiftUI and reservedRegions(kind:options:).

As a final consideration, developers should account for the fact that iPhone Duo can capture photos and video from the outer display camera, inner display camera, and rear camera. Opening, closing, or rotating the device can change which camera is active. Developers can select the appropriate camera to use based on the direction it faces.

App developer Steve Troughton-Smith reacted critically to Apple's announcement on Mastodon, observing that "[this is like a whole new platform dropping with a month's lead time]"(https://mastodon.social/@stroughtonsmith/117242683983898756). This sentiment was echoed by user David, who "wonder[ed] how many apps will bother to support the Duo in the coming months".

iOS Dev Weekly editor Juan Marin noted that this is not the first time that iOS developers have faced similar requirements:

The trouble with beautiful devices is that they arrive with homework, and the homework is always ours. [...] Each time, Apple had told us years ahead what to do to prepare. Each time, most of us did it afterwards.

However, he concedes, it was already known that using "UIScreen.main.bounds is a bug waiting for a device, and the device has finally turned up".

About the Author

Rate this Article

Adoption
Style

BT