how to add/remove childviewcontroller
Asked on 04/03/2025
1 search
To add or remove a child view controller in the context of multiview video playback in visionOS, you can follow these steps:
-
Adding a Child View Controller:
- Create a new
AVPlayerViewController
and set it up to play the chosen content. - Access its
AVExperienceController
and add Multiview to the allowed experiences. - Transition the experience controller to Multiview, and the
AVMultiviewManager
will handle the rest.
- Create a new
-
Removing a Child View Controller:
- Use the content browser to remove content from Multiview.
- Transition the experience controller for that content to another allowed experience, such as "embedded."
- If the corresponding
AVPlayerViewController
was not previously installed in a view hierarchy, the multiview manager will make it disappear.
For more detailed guidance, you can refer to the session Explore multiview video playback in visionOS (04:59).

SwiftUI essentials
Join us on a tour of SwiftUI, Apple’s declarative user interface framework. Learn essential concepts for building apps in SwiftUI, like views, state variables, and layout. Discover the breadth of APIs for building fully featured experiences and crafting unique custom components. Whether you’re brand new to SwiftUI or an experienced developer, you’ll learn how to take advantage of what SwiftUI has to offer when building great apps.

Demystify SwiftUI containers
Learn about the capabilities of SwiftUI container views and build a mental model for how subviews are managed by their containers. Leverage new APIs to build your own custom containers, create modifiers to customize container content, and give your containers that extra polish that helps your apps stand out.

What’s new in SwiftUI
Learn how you can use SwiftUI to build great apps for any Apple platform. Explore a fresh new look and feel for tabs and documents on iPadOS. Improve your window management with new windowing APIs, and gain more control over immersive spaces and volumes in your visionOS apps. We’ll also take you through other exciting refinements that help you make expressive charts, customize and layout text, and so much more.