ManeuverType
public enum ManeuverType : String, Codable
A ManeuverType
specifies the type of maneuver required to complete the route step. You can pair a maneuver type with a ManeuverDirection
to choose an appropriate visual or voice prompt to present the user.
To avoid a complex series of if-else-if statements or switch statements, use pattern matching with a single switch statement on a tuple that consists of the maneuver type and maneuver direction.
-
The step requires the user to depart from a waypoint.
If the waypoint is some distance away from the nearest road, the maneuver direction indicates the direction the user must turn upon reaching the road.
Declaration
Swift
case depart
-
The step requires the user to turn.
The maneuver direction indicates the direction in which the user must turn relative to the current direction of travel. The exit index indicates the number of intersections, large or small, from the previous maneuver up to and including the intersection at which the user must turn.
Declaration
Swift
case turn
-
The step requires the user to continue after a turn.
Declaration
Swift
case `continue`
-
The step requires the user to continue on the current road as it changes names.
The step’s name contains the road’s new name. To get the road’s old name, use the previous step’s name.
Declaration
Swift
case passNameChange = "new name"
-
The step requires the user to merge onto another road.
The maneuver direction indicates the side from which the other road approaches the intersection relative to the user.
Declaration
Swift
case merge
-
The step requires the user to take a entrance ramp (slip road) onto a highway.
Declaration
Swift
case takeOnRamp = "on ramp"
-
The step requires the user to take an exit ramp (slip road) off a highway.
The maneuver direction indicates the side of the highway from which the user must exit. The exit index indicates the number of highway exits from the previous maneuver up to and including the exit that the user must take.
Declaration
Swift
case takeOffRamp = "off ramp"
-
The step requires the user to choose a fork at a Y-shaped fork in the road.
The maneuver direction indicates which fork to take.
Declaration
Swift
case reachFork = "fork"
-
The step requires the user to turn at either a T-shaped three-way intersection or a sharp bend in the road where the road also changes names.
This maneuver type is called out separately so that the user may be able to proceed more confidently, without fear of having overshot the turn. If this distinction is unimportant to you, you may treat the maneuver as an ordinary
turn
.Declaration
Swift
case reachEnd = "end of road"
-
The step requires the user to get into a specific lane in order to continue along the current road.
The maneuver direction is set to
straightAhead
. Each of the first intersection’s usable approach lanes also has an indication ofstraightAhead
. A maneuver in a different direction would instead have a maneuver type ofturn
.This maneuver type is called out separately so that the application can present the user with lane guidance based on the first element in the
intersections
property. If lane guidance is unimportant to you, you may treat the maneuver as an ordinarycontinue
or ignore it.Declaration
Swift
case useLane = "use lane"
-
The step requires the user to enter and traverse a roundabout (traffic circle or rotary).
The step has no name, but the exit name is the name of the road to take to exit the roundabout. The exit index indicates the number of roundabout exits up to and including the exit to take.
If
RouteOptions.includesExitRoundaboutManeuver
is set totrue
, this step is followed by an.exitRoundabout
maneuver. Otherwise, this step represents the entire roundabout maneuver, from the entrance to the exit.Declaration
Swift
case takeRoundabout = "roundabout"
-
The step requires the user to enter and traverse a large, named roundabout (traffic circle or rotary).
The step’s name is the name of the roundabout. The exit name is the name of the road to take to exit the roundabout. The exit index indicates the number of rotary exits up to and including the exit that the user must take.
If
RouteOptions.includesExitRoundaboutManeuver
is set totrue
, this step is followed by an.exitRotary
maneuver. Otherwise, this step represents the entire roundabout maneuver, from the entrance to the exit.Declaration
Swift
case takeRotary = "rotary"
-
The step requires the user to enter and exit a roundabout (traffic circle or rotary) that is compact enough to constitute a single intersection.
The step’s name is the name of the road to take after exiting the roundabout. This maneuver type is called out separately because the user may perceive the roundabout as an ordinary intersection with an island in the middle. If this distinction is unimportant to you, you may treat the maneuver as either an ordinary
turn
or as atakeRoundabout
.Declaration
Swift
case turnAtRoundabout = "roundabout turn"
-
The step requires the user to exit a roundabout (traffic circle or rotary).
This maneuver type follows a
.takeRoundabout
maneuver. It is only used whenRouteOptions.includesExitRoundaboutManeuver
is set to true.Declaration
Swift
case exitRoundabout = "exit roundabout"
-
The step requires the user to exit a large, named roundabout (traffic circle or rotary).
This maneuver type follows a
.takeRotary
maneuver. It is only used whenRouteOptions.includesExitRoundaboutManeuver
is set to true.Declaration
Swift
case exitRotary = "exit rotary"
-
The step requires the user to respond to a change in travel conditions.
This maneuver type may occur for example when driving directions require the user to board a ferry, or when cycling directions require the user to dismount. The step’s transport type and instructions contains important contextual details that should be presented to the user at the maneuver location.
Similar changes can occur simultaneously with other maneuvers, such as when the road changes its name at the site of a movable bridge. In such cases,
heedWarning
is suppressed in favor of another maneuver type.Declaration
Swift
case heedWarning = "notification"
-
The step requires the user to arrive at a waypoint.
The distance and expected travel time for this step are set to zero, indicating that the route or route leg is complete. The maneuver direction indicates the side of the road on which the waypoint can be found (or whether it is straight ahead).
Declaration
Swift
case arrive