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

# CPAlertTemplate

A template that displays a modal alert.

```
@MainActor class CPAlertTemplate
```

## Overview

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

## Topics

### Creating an Alert Template

[`-  initWithTitleVariants:actions:`](/documentation/CarPlay/CPAlertTemplate/init(titleVariants:actions:))

Creates an alert template.

[`maximumActionCount`](/documentation/CarPlay/CPAlertTemplate/maximumActionCount)

The maximum number of actions allowed in an alert template.

### Getting the Alert Information

[`titleVariants`](/documentation/CarPlay/CPAlertTemplate/titleVariants)

The array of title variants.

[`actions`](/documentation/CarPlay/CPAlertTemplate/actions)

The array of actions available on the alert.

## Relationships

### Conforms To

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

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

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

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

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

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

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

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

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

[`NSCoding`](/documentation/Foundation/NSCoding)

### Inherits From

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

---

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)