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


class CPNavigationAlert : NSObject


To display a navigation alert, create an instance of CPNavigationAlert and pass it to the map template’s 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 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:).


Getting Titles

var titleVariants: [String]

An array of title strings.

var subtitleVariants: [String]

An array of subtitle strings.

Getting the Alert Image

var imageSet: CPImageSet?

An image set displayed in the navigation alert.

Getting the Actions

var primaryAction: CPAlertAction

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

var secondaryAction: CPAlertAction?

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

Getting the Alert Duration

var duration: TimeInterval

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

let CPNavigationAlertMinimumDuration: TimeInterval

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

Instance Properties

var image: UIImage?

An image displayed in the navigation alert.


enum CPNavigationAlert.DismissalContext

A set of reasons for dismissing a navigation alert.


Inherits From

See Also

Displaying a Navigation Alert

func present(navigationAlert: CPNavigationAlert, animated: Bool)

Displays a navigation alert on the map template.

func dismissNavigationAlert(animated: Bool, completion: (Bool) -> Void)

Tells the map template to dismiss the visable navigation alert.