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

# CPNavigationAlert

An alert that displays map- or navigation-related information to the user.

```
@MainActor class CPNavigationAlert
```

## Overview

To display a navigation alert, create an instance of [`CPNavigationAlert`](/documentation/CarPlay/CPNavigationAlert) and pass it to the map template’s [`present(navigationAlert:animated:)`](/documentation/CarPlay/CPMapTemplate/present(navigationAlert:animated:)) method. When creating an alert, you must provide a title, action, and duration. The duration tells the system how long to show the alert before automatically dismissing it. You can also include a subtitle and secondary action when needed.

The system displays the primary and secondary actions as buttons on the alert. After the user taps the button, the system calls the action’s [`handler`](/documentation/CarPlay/CPAlertAction/handler) block, which is where your app performs the requested action. The system also dismisses the alert after the user taps the button. However, your app can dismiss the alert without any user interaction by calling [`dismissNavigationAlert(animated:completion:)`](/documentation/CarPlay/CPMapTemplate/dismissNavigationAlert(animated:completion:)).

## Topics

### Creating a Navigation Alert

[`-  initWithTitleVariants:subtitleVariants:image:primaryAction:secondaryAction:duration:`](/documentation/CarPlay/CPNavigationAlert/init(titleVariants:subtitleVariants:image:primaryAction:secondaryAction:duration:))

Creates a navigation alert.

[`-  initWithTitleVariants:subtitleVariants:imageSet:primaryAction:secondaryAction:duration:`](/documentation/CarPlay/CPNavigationAlert/init(titleVariants:subtitleVariants:imageSet:primaryAction:secondaryAction:duration:))

Creates a navigation alert.

### Getting Titles

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

An array of title strings.

[`subtitleVariants`](/documentation/CarPlay/CPNavigationAlert/subtitleVariants)

An array of subtitle strings.

[`-  updateTitleVariants:subtitleVariants:`](/documentation/CarPlay/CPNavigationAlert/updateTitleVariants(_:subtitleVariants:))

Updates title and subtitle variants.

### Getting the Alert Image

[`image`](/documentation/CarPlay/CPNavigationAlert/image)

An image displayed in the navigation alert.

[`imageSet`](/documentation/CarPlay/CPNavigationAlert/imageSet)

An image set displayed in the navigation alert.

### Getting the Actions

[`primaryAction`](/documentation/CarPlay/CPNavigationAlert/primaryAction)

The primary action, and button, for the navigation alert.

[`secondaryAction`](/documentation/CarPlay/CPNavigationAlert/secondaryAction)

An optional secondary action, and button, for the navigation alert.

### Getting the Alert Duration

[`duration`](/documentation/CarPlay/CPNavigationAlert/duration)

The amount of time, in seconds, that the alert is visible.

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

A constant that defines the minimum amount of time that an alert is visible.

### Enumerations

[`DismissalContext`](/documentation/CarPlay/CPNavigationAlert/DismissalContext)

A set of reasons for dismissing a navigation alert.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

### 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)