Class

CPListTemplate

A template that displays a hierarchical list of items.

Declaration

class CPListTemplate : CPTemplate

Overview

When creating a list template, populate the list with an array of CPListSection objects. Each section contains an array of CPListItem objects. Each list item contains a title, and may also include a subtitle, image, and disclosure indicator to show the presence of a sublist.

To display the list on the CarPlay screen, call the interface controller’s pushTemplate(_:animated:) method, passing in the list template. When the user selects an item from the list, the system calls listTemplate(_:didSelect:completionHandler:), which your delegate object implements.

Topics

Creating a List Template

init(title: String?, sections: [CPListSection])

Creates a list template with an array of list sections and optional title.

class CPListSection

A section of list items that appear in a list template.

Handling List Template Events

var delegate: CPListTemplateDelegate?

The object serving as the delegate to the list template.

protocol CPListTemplateDelegate

The interface an object implements to serve as the delegate for a list template.

Managing List Sections

var sections: [CPListSection]

The sections displayed in the list.

func updateSections([CPListSection])

Updates the list with the provided sections.

Getting the Title

var title: String?

The title displayed in the navigation bar while the list template is visible.

Relationships

Inherits From

See Also

User Interface Basics

class CPInterfaceController

A controller that manages the templates that provide the user interface for your app on the CarPlay screen.

class CPMapTemplate

A template that provides a navigation bar and map buttons allowing users to interact with your app.

class CPGridTemplate

A template that displays a grid of items.

class CPTemplate

An abstract base class for interface templates.

class CPImageSet

Light and dark representations of an image.