---
title: CPAlertTemplate
framework: carplay
role: symbol
role_heading: Class
path: carplay/cpalerttemplate
---

# CPAlertTemplate

A template that displays a modal alert.

## Declaration

```swift
@MainActor class CPAlertTemplate
```

## Overview

Overview You must present alerts modally by calling the presentTemplate(_:animated:completion:) method available on your app’s instance of CPInterfaceController. The user dismisses the alert by pressing a button, or you can dismiss it by calling the interface controller’s dismissTemplate(animated:completion:) method.

## Topics

### Creating an Alert Template

- [init(titleVariants:actions:)](carplay/cpalerttemplate/init(titlevariants:actions:).md)
- [maximumActionCount](carplay/cpalerttemplate/maximumactioncount.md)

### Getting the Alert Information

- [titleVariants](carplay/cpalerttemplate/titlevariants.md)
- [actions](carplay/cpalerttemplate/actions.md)

## Relationships

### Inherits From

- [CPTemplate](carplay/cptemplate.md)

### Conforms To

- [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

### Actions and Alerts

- [CPActionSheetTemplate](carplay/cpactionsheettemplate.md)
- [CPAlertAction](carplay/cpalertaction.md)
