<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CarPlay",
  "identifier" : "/documentation/CarPlay/CPInterfaceController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "CarPlay"
    ],
    "preciseIdentifier" : "c:objc(cs)CPInterfaceController"
  },
  "title" : "CPInterfaceController"
}
-->

# CPInterfaceController

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

```
@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`](/documentation/CarPlay/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:)`](/documentation/CarPlay/CPInterfaceController/setRootTemplate(_:animated:completion:)) method. To display another template in the navigation hierarchy, call [`pushTemplate(_:animated:completion:)`](/documentation/CarPlay/CPInterfaceController/pushTemplate(_:animated:completion:)), and use [`popTemplate(animated:completion:)`](/documentation/CarPlay/CPInterfaceController/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:)`](/documentation/CarPlay/CPInterfaceController/presentTemplate(_:animated:completion:)) to display the modal template, and call [`dismissTemplate(animated:completion:)`](/documentation/CarPlay/CPInterfaceController/dismissTemplate(animated:completion:)) to dismiss it.

## Topics

### Configuring the Interface Controller

[`delegate`](/documentation/CarPlay/CPInterfaceController/delegate)

An object that serves as the delegate to the interface controller.

[`CPInterfaceControllerDelegate`](/documentation/CarPlay/CPInterfaceControllerDelegate)

The interface that an object implements to serve as a delegate to an interface controller.

[`prefersDarkUserInterfaceStyle`](/documentation/CarPlay/CPInterfaceController/prefersDarkUserInterfaceStyle)

A Boolean value that determines whether the system draws the user interface in Dark Mode.

[`-  setRootTemplate:animated:completion:`](/documentation/CarPlay/CPInterfaceController/setRootTemplate(_:animated:completion:))

Sets the root template of the navigation hierarchy.

### Accessing the Trait Collection

[`carTraitCollection`](/documentation/CarPlay/CPInterfaceController/carTraitCollection)

The trait collection of the vehicle’s primary screen.

### Accessing Templates

[`rootTemplate`](/documentation/CarPlay/CPInterfaceController/rootTemplate)

The root template in the navigation hierarchy.

[`topTemplate`](/documentation/CarPlay/CPInterfaceController/topTemplate)

The top-most template in the navigation hierarchy.

[`templates`](/documentation/CarPlay/CPInterfaceController/templates)

The contents of the navigation hierarchy.

### Adding and Removing Templates

[`-  pushTemplate:animated:completion:`](/documentation/CarPlay/CPInterfaceController/pushTemplate(_:animated:completion:))

Adds the specified template to the navigation hierarchy and displays it.

[`-  popTemplateAnimated:completion:`](/documentation/CarPlay/CPInterfaceController/popTemplate(animated:completion:))

Removes the top-most template from the navigation hierarchy.

[`-  popToRootTemplateAnimated:completion:`](/documentation/CarPlay/CPInterfaceController/popToRootTemplate(animated:completion:))

Removes all of the templates from the navigation hierarchy except the root template.

[`-  popToTemplate:animated:completion:`](/documentation/CarPlay/CPInterfaceController/pop(to:animated:completion:))

Removes each template from the navigation hierarchy until the specified template becomes visible.

### Displaying Templates Modally

[`-  presentTemplate:animated:completion:`](/documentation/CarPlay/CPInterfaceController/presentTemplate(_:animated:completion:))

Presents a template modally.

[`-  dismissTemplateAnimated:completion:`](/documentation/CarPlay/CPInterfaceController/dismissTemplate(animated:completion:))

Dismisses a modal template.

[`presentedTemplate`](/documentation/CarPlay/CPInterfaceController/presentedTemplate)

The interface controller’s current modal template.

### Deprecated

[Deprecated Symbols](/documentation/CarPlay/cpinterfacecontroller-deprecated-symbols)

Review unsupported symbols and their replacements.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Sendable`](/documentation/Swift/Sendable)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)