Contents

CPInterfaceController

A controller that manages the templates for constructing a scene’s user interface.

Declaration

@MainActor class CPInterfaceController

Overview

An interface controller manages one or more templates in the navigation hierarchy. You don’t create the interface controller. Instead, CarPlay creates one for you and passes it to the delegate of CPTemplateApplicationScene when the scene connects.

After receiving the controller, store a reference to it in your app. Then set the root template by calling the setRootTemplate(_:animated:completion:) method. To display another template in the navigation hierarchy, call pushTemplate(_:animated:completion:), and use popTemplate(animated:completion:) to remove the top-most template.

You also use the interface controller to display a single template modally. Call presentTemplate(_:animated:completion:) to display the modal template, and call dismissTemplate(animated:completion:) to dismiss it.

Topics

Configuring the Interface Controller

Accessing the Trait Collection

Accessing Templates

Adding and Removing Templates

Displaying Templates Modally

Deprecated

See Also

Accessing the Interface Controller