Contents

Multitasking on iPad, Mac, and Apple Vision Pro

Implement multitasking APIs to seamlessly integrate your app with iPadOS, macOS, and visionOS.

Overview

While your app’s scene runs in the foreground on iPad, Mac, or Apple Vision Pro, other apps are likely to be running alongside it. Being aware of the environment your app may be running in and adopting the multitasking APIs are an essential part of integrating your apps with iPadOS, macOS, and visionOS.

Adapting to different window sizes

The first step in creating a great multitasking experience for people is to ensure your app’s scenes can adapt to different window sizes. Start by reading Layout in the Human Interface Guidelines.

Consider that your app may be running in a smaller window rather than full screen. Discover your app’s environment with UITraitCollection and adapt to it by using Auto Layout or Automatic trait tracking. Or, register to observe specific trait changes on your view or view controller with UITraitChangeObservable methods. Since people can resize your app’s window, set a minimum size for your window with UISceneSizeRestrictions.

To observe a scene’s geometry changing, use windowScene(_:didUpdateEffectiveGeometry:) and compare the coordinateSpace.bounds of both geometries. Check isInteractivelyResizing to determine if a person is currently resizing the scene, and adjust what assets you update during resizing to improve performance.

Supporting multiple scenes

You can choose to allow multiple scenes in your app’s UI to run concurrently by setting the UIApplicationSupportsMultipleScenes property list key. Implement Scenes and read Managing your app’s life cycle for an overview of how UISceneDelegate interacts with the system multitasking events. For information on adopting the scene-based life cycle, see TN3187: Migrating to the UIKit scene-based life cycle.

Supporting different interface orientations

Design your app’s scenes to display correctly in any interface orientation. In situations where you want to lock the app’s interface to its current orientation, call setNeedsUpdateOfPrefersInterfaceOrientationLocked(), then return true as the value of prefersInterfaceOrientationLocked, or override childForInterfaceOrientationLock to delegate the decision to a child view controller. Implement windowScene(_:didUpdateEffectiveGeometry:) to observe orientation changes, as the system might change the interface orientation even if you signal a preference to lock it. The preference to lock the interface orientation lasts until your app stops presenting the scene, or you call setNeedsUpdateOfPrefersInterfaceOrientationLocked() again and return false as the value of prefersInterfaceOrientationLocked.

Topics

Adaptivity

Scene Management

See Also

iPad, Mac, and Apple Vision Pro