NavigationRouteOptions
open class NavigationRouteOptions : RouteOptions, OptimizedForNavigation
A NavigationRouteOptions
object specifies turn-by-turn-optimized criteria for results returned by the Mapbox Directions API.
NavigationRouteOptions
is a subclass of RouteOptions
that has been optimized for navigation. Pass an instance of this class into the Directions.calculate(_:completionHandler:)
method.
This class implements the NSCopying
protocol by round-tripping the object through JSONEncoder
and JSONDecoder
. If you subclass NavigationRouteOptions
, make sure any properties you add are accounted for in Decodable(from:)
and Encodable.encode(to:)
. If your subclass contains any customizations that cannot be represented in JSON, make sure the subclass overrides NSCopying.copy(with:)
to persist those customizations.
NavigationRouteOptions
is designed to be used with the Directions
and NavigationDirections
classes for specifying routing criteria. To customize the user experience in a NavigationViewController
, use the NavigationOptions
class.
-
Initializes a navigation route options object for routes between the given waypoints and an optional profile identifier optimized for navigation.
Seealso
RouteOptions
Declaration
Swift
public required init(waypoints: [Waypoint], profileIdentifier: ProfileIdentifier? = .automobileAvoidingTraffic, queryItems: [URLQueryItem]? = nil)
-
Initializes an equivalent
RouteOptions
object from aNavigationMapOptions
Seealso
NavigationMatchOptions
Declaration
Swift
public convenience init(navigationMatchOptions options: NavigationMatchOptions)
-
Initializes a navigation route options object for routes between the given locations and an optional profile identifier optimized for navigation.
Seealso
RouteOptions
Declaration
Swift
public convenience init(locations: [CLLocation], profileIdentifier: ProfileIdentifier? = .automobileAvoidingTraffic, queryItems: [URLQueryItem]? = nil)
-
Initializes a route options object for routes between the given geographic coordinates and an optional profile identifier optimized for navigation.
Seealso
RouteOptions
Declaration
Swift
public convenience init(coordinates: [CLLocationCoordinate2D], profileIdentifier: ProfileIdentifier? = .automobileAvoidingTraffic, queryItems: [URLQueryItem]? = nil)
-
Declaration
Swift
required public init(from decoder: Decoder) throws