Platform features

Split View, multiple windows and keeping state

How iPhone Duo handles Split View multitasking, multiple app windows, state across folds, keyboards and Picture in Picture, and what developers need to change.

6 min readUpdated 3 sources

iPhone Duo is the first iPhone where your app may share the screen with another app, and the first that can show more than one window of your app. If you already support iPad multitasking or resizing in iPhone Mirroring, most of this works already.1

Split View

Every app takes part in multitasking on iPhone Duo. Two apps can sit side by side, and there’s also a new layout that stacks video with an app. Both reach your app as a size change, so the same rules apply: drive layout from size classes and scene geometry, never from orientation or the screen. A portrait-locked app still has to adapt, because the inner display ignores supported orientations.13

Your scene’s size isn’t settable and people can’t freely drag-resize it. Sizes change only with the pose and with Split View, which makes them easy to test in the iPhone Duo simulator.2

Folding keeps your state

Opening, closing or folding the phone is a resize and trait change. Your scene isn’t disconnected and your process keeps running, so text being typed, scroll position, video playback, camera sessions and editing state all carry over without extra work.1

State restoration is still worth doing, but only for scenes that are genuinely disconnected and reconnected. Implement stateRestorationActivity(for:) on your UISceneDelegate and return an NSUserActivity.2

Two related details:

  • UserDefaults and @AppStorage are app-wide, not per window. Don’t keep per-window state there.
  • The keyboard doesn’t get its own scene. Keep the active text field visible with keyboardWillShowNotification, keyboardWillHideNotification and keyboardWillChangeFrameNotification.2

Multiple windows

Apps that support multiple windows on iPad get them on iPhone Duo too, with one important difference: new windows can only be created on the inner display. Window availability is dynamic, so:

  • Handle errors whenever you request a new scene.
  • Use UIWindowSceneActivationAction for “Open in new window” commands. It hides itself automatically when a new window isn’t possible.1

If your app has never supported multiple scenes, Apple’s documentation on adopting scenes is the place to start. It isn’t required for iPhone Duo.2

Picture in Picture and media

PiP through AVPlayerViewController or AVPictureInPictureController works as on other iPhones. In landscape, the PiP window can be pinned to the top while your app resizes below it. Partly folded, video can fill half the screen while the app adjusts in real time. PiP moves to the outer display only when the phone closes, and the system controls that transition.2

Audio-only players can’t use PiP: use background audio and Now Playing. With several windows open, audio and video belong to whichever instance most recently started a playback session.2

Showing content on both displays

Apps can’t draw on the outer display directly. Instead you register scene accessory content, and the system decides when and where to show it. Today the main case is camera apps, covered in Camera apps and the outer display. Accessory content can be withdrawn at any moment, so its animations must start, pause and stop cleanly.1

Live Activities and the Dynamic Island also appear on iPhone Duo, with the Dynamic Island moving to the side of the display when closed and in some poses. Make sure every Live Activity implements all of its presentations: compactLeading, compactTrailing, minimal, the expanded regions and the Lock Screen view.1

Sources

  1. Tech Talk: Leverage multiple displays and scenes on iPhone Duo
  2. Apple Developer Forums: A summary of the iPhone Duo Group Lab
  3. Tech Talk: Prepare your app for iPhone Duo