---
title: CPMapTemplate
framework: carplay
role: symbol
role_heading: Class
path: carplay/cpmaptemplate
---

# CPMapTemplate

A template that displays a navigation overlay that your app draws on the map.

## Declaration

```swift
@MainActor class CPMapTemplate
```

## Overview

Overview After CarPlay calls your scene delegate’s templateApplicationScene(_:didConnect:to:) method, create a map template and set it as the root template by calling setRootTemplate(_:animated:completion:) on the interface controller the method provides. The map template appears as an overlay on top of the base view. The template is the control layer, providing a navigation bar and map buttons that users interact with through the CarPlay screen. note: The base view is where your app draws its map. CarPlay doesn’t support direct user interactions in this view. Instead, your app uses templates, which overlay the base view, to allow users to interact with your app through the CarPlay screen. When the user begins to interact with your app through the CarPlay screen, the system displays the navigation bar, hiding it after a brief period of inactivity. You can change this behavior by setting the automaticallyHidesNavigationBar and hidesButtonsWithNavigationBar properties. The navigation bar includes up to two leading and two trailing buttons. You can change the buttons, including their titles and icon images, by setting the leadingNavigationBarButtons and trailingNavigationBarButtons properties on your template. You can display additional map buttons by providing an array of CPMapButton objects to mapButtons. Use these buttons to provide users access to actions, such as entering panning mode or zooming in and out on the map.

## Topics

### Configuring Map Templates

- [automaticallyHidesNavigationBar](carplay/cpmaptemplate/automaticallyhidesnavigationbar.md)
- [hidesButtonsWithNavigationBar](carplay/cpmaptemplate/hidesbuttonswithnavigationbar.md)
- [guidanceBackgroundColor](carplay/cpmaptemplate/guidancebackgroundcolor.md)

### Handling Map Template Events

- [mapDelegate](carplay/cpmaptemplate/mapdelegate.md)
- [CPMapTemplateDelegate](carplay/cpmaptemplatedelegate.md)

### Managing Map Buttons

- [mapButtons](carplay/cpmaptemplate/mapbuttons.md)
- [CPMapButton](carplay/cpmapbutton.md)

### Displaying Trip Previews

- [showTripPreviews(_:textConfiguration:)](carplay/cpmaptemplate/showtrippreviews(_:textconfiguration:).md)
- [showTripPreviews(_:selectedTrip:textConfiguration:)](carplay/cpmaptemplate/showtrippreviews(_:selectedtrip:textconfiguration:).md)
- [hideTripPreviews()](carplay/cpmaptemplate/hidetrippreviews().md)
- [showRouteChoicesPreview(for:textConfiguration:)](carplay/cpmaptemplate/showroutechoicespreview(for:textconfiguration:).md)
- [CPTripPreviewTextConfiguration](carplay/cptrippreviewtextconfiguration.md)

### Navigating a Trip

- [startNavigationSession(for:)](carplay/cpmaptemplate/startnavigationsession(for:).md)
- [CPNavigationSession](carplay/cpnavigationsession.md)

### Providing Trip Estimates

- [updateEstimates(_:for:)](carplay/cpmaptemplate/updateestimates(_:for:).md)
- [update(_:for:with:)](carplay/cpmaptemplate/update(_:for:with:).md)
- [CPTimeRemainingColor](carplay/cptimeremainingcolor.md)
- [tripEstimateStyle](carplay/cpmaptemplate/tripestimatestyle.md)
- [CPTripEstimateStyle](carplay/cptripestimatestyle.md)

### Displaying a Navigation Alert

- [present(navigationAlert:animated:)](carplay/cpmaptemplate/present(navigationalert:animated:).md)
- [dismissNavigationAlert(animated:completion:)](carplay/cpmaptemplate/dismissnavigationalert(animated:completion:).md)
- [currentNavigationAlert](carplay/cpmaptemplate/currentnavigationalert.md)
- [CPNavigationAlert](carplay/cpnavigationalert.md)

### Panning the Map

- [showPanningInterface(animated:)](carplay/cpmaptemplate/showpanninginterface(animated:).md)
- [dismissPanningInterface(animated:)](carplay/cpmaptemplate/dismisspanninginterface(animated:).md)
- [isPanningInterfaceVisible](carplay/cpmaptemplate/ispanninginterfacevisible.md)

### Instance Methods

- [hidePanel(completion:)](carplay/cpmaptemplate/hidepanel(completion:).md)
- [popPanel(completion:)](carplay/cpmaptemplate/poppanel(completion:).md)
- [pushPanel(_:completion:)](carplay/cpmaptemplate/pushpanel(_:completion:).md)
- [showPanel(_:completion:)](carplay/cpmaptemplate/showpanel(_:completion:).md)

## Relationships

### Inherits From

- [CPTemplate](carplay/cptemplate.md)

### Conforms To

- [CPBarButtonProviding](carplay/cpbarbuttonproviding.md)
- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Navigation

- [Integrating CarPlay with Your Navigation App](carplay/integrating-carplay-with-your-navigation-app.md)
- [CPTemplateApplicationDashboardScene](carplay/cptemplateapplicationdashboardscene.md)
- [CPTemplateApplicationDashboardSceneDelegate](carplay/cptemplateapplicationdashboardscenedelegate.md)
- [CPSearchTemplate](carplay/cpsearchtemplate.md)
- [CPVoiceControlTemplate](carplay/cpvoicecontroltemplate.md)
