<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CarPlay",
  "identifier" : "/documentation/CarPlay/CPNavigationAlert/init(titleVariants:subtitleVariants:image:primaryAction:secondaryAction:duration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "CarPlay"
    ],
    "preciseIdentifier" : "c:objc(cs)CPNavigationAlert(im)initWithTitleVariants:subtitleVariants:image:primaryAction:secondaryAction:duration:"
  },
  "title" : "init(titleVariants:subtitleVariants:image:primaryAction:secondaryAction:duration:)"
}
-->

# init(titleVariants:subtitleVariants:image:primaryAction:secondaryAction:duration:)

Creates a navigation alert.

```
init(titleVariants: [String], subtitleVariants: [String]?, image: UIImage?, primaryAction: CPAlertAction, secondaryAction: CPAlertAction?, duration: TimeInterval)
```

## Parameters

`titleVariants`

An array of localized, displayable titles in order of preference. CarPlay displays the title that fits in the available screen space.

`subtitleVariants`

An array of localized, displayable subtitles in order of preference. CarPlay displays the subtitle that fits in the available screen space.

`image`

The image the alert displays.

`primaryAction`

The alert’s primary action.

`secondaryAction`

The alert’s secondary action.

`duration`

The amount of time, in seconds, that the alert remains visible. If you provide a duration of 0, CarPlay displays the alert until the user dismisses it.

## Discussion

Provide an image that is display-ready. If necessary, provide light and dark variants using an asset catalog, or use an instance of <doc://com.apple.documentation/documentation/UIKit/UIImageAsset> and register an image for each interface style. To properly size your image, use the display scale of the vehicle’s primary screen, which you access from your interface controller’s [`carTraitCollection`](/documentation/CarPlay/CPInterfaceController/carTraitCollection) property.

CarPlay doesn’t support animated images. If you provide an animated image, CarPlay uses only the first image in the animation sequence.

---

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)