RouteOptions
open class RouteOptions : DirectionsOptionsA RouteOptions object is a structure that specifies the criteria for results returned by the Mapbox Directions API.
Pass an instance of this class into the Directions.calculate(_:completionHandler:) method.
- 
                  
                  Initializes a route options object for routes between the given waypoints and an optional profile identifier. DeclarationSwift public required init(waypoints: [Waypoint], profileIdentifier: DirectionsProfileIdentifier? = nil)ParameterswaypointsAn array of Waypointobjects representing locations that the route should visit in chronological order. The array should contain at least two waypoints (the source and destination) and at most 25 waypoints. (Some profiles, such asDirectionsProfileIdentifier.automobileAvoidingTraffic, may have lower limits.)profileIdentifierA string specifying the primary mode of transportation for the routes. DirectionsProfileIdentifier.automobileis used by default.
- 
                  
                  Initializes a route options object for routes between the given locations and an optional profile identifier. Note This initializer is intended for CLLocationobjects created using theCLLocation.init(latitude:longitude:)initializer. If you intend to use aCLLocationobject obtained from aCLLocationManagerobject, consider increasing thehorizontalAccuracyor set it to a negative value to avoid overfitting, since theWaypointclass’scoordinateAccuracyproperty represents the maximum allowed deviation from the waypoint.DeclarationSwift public convenience init(locations: [CLLocation], profileIdentifier: DirectionsProfileIdentifier? = nil)ParameterslocationsAn array of CLLocationobjects representing locations that the route should visit in chronological order. The array should contain at least two locations (the source and destination) and at most 25 locations. Each location object is converted into aWaypointobject. This class respects theCLLocationclass’scoordinateandhorizontalAccuracyproperties, converting them into theWaypointclass’scoordinateandcoordinateAccuracyproperties, respectively.profileIdentifierA string specifying the primary mode of transportation for the routes. DirectionsProfileIdentifier.automobileis used by default.
- 
                  
                  Initializes a route options object for routes between the given geographic coordinates and an optional profile identifier. DeclarationSwift public convenience init(coordinates: [CLLocationCoordinate2D], profileIdentifier: DirectionsProfileIdentifier? = nil)ParameterscoordinatesAn array of geographic coordinates representing locations that the route should visit in chronological order. The array should contain at least two locations (the source and destination) and at most 25 locations. Each coordinate is converted into a Waypointobject.profileIdentifierA string specifying the primary mode of transportation for the routes. DirectionsProfileIdentifier.automobileis used by default.
- 
                  
                  Initializes an equivalent route options object from a match options object. Desirable for building a navigation experience from map matching. DeclarationSwift public convenience init(matchOptions: MatchOptions)ParametersmatchOptionsThe MatchOptionsthat is being used to convert to aRouteOptionsobject.
- 
                  
                  A Boolean value that indicates whether a returned route may require a point U-turn at an intermediate waypoint. If the value of this property is true, a returned route may require an immediate U-turn at an intermediate waypoint. At an intermediate waypoint, if the value of this property isfalse, each returned route may continue straight ahead or turn to either side but may not U-turn. This property has no effect if only two waypoints are specified.Set this property to trueif you expect the user to traverse each leg of the trip separately. For example, it would be quite easy for the user to effectively “U-turn” at a waypoint if the user first parks the car and patronizes a restaurant there before embarking on the next leg of the trip. Set this property tofalseif you expect the user to proceed to the next waypoint immediately upon arrival. For example, if the user only needs to drop off a passenger or package at the waypoint before continuing, it would be inconvenient to perform a U-turn at that location.The default value of this property is falsewhen the profile identifier isDirectionsProfileIdentifier.automobileorDirectionsProfileIdentifier.automobileAvoidingTrafficandtrueotherwise.DeclarationSwift open var allowsUTurnAtWaypoint: Bool
- 
                  
                  The route classes that the calculated routes will avoid. Currently, you can only specify a single road class to avoid. DeclarationSwift open var roadClassesToAvoid: RoadClasses
- 
                  
                  A number that influences whether the route should prefer or avoid alleys or narrow service roads between buildings. This property has no effect unless the profile identifier is set to DirectionsProfileIdentifier.automobileorDirectionsProfileIdentifier.walking.The value of this property must be at least DirectionsPriority.lowand at mostDirectionsPriority.high. The default value ofDirectionsPriority.defaultneither prefers nor avoids alleys, while a negative value betweenDirectionsPriority.lowandDirectionsPriority.defaultavoids alleys, and a positive value betweenDirectionsPriority.defaultandDirectionsPriority.highprefers alleys. A value of 0.9 is suitable for pedestrians who are comfortable with walking down alleys.DeclarationSwift open var alleyPriority: DirectionsPriority
- 
                  
                  A number that influences whether the route should prefer or avoid roads or paths that are set aside for pedestrian-only use (walkways or footpaths). This property has no effect unless the profile identifier is set to DirectionsProfileIdentifier.walking. You can adjust this property to avoid sidewalks and crosswalks that are mapped as separate footpaths, which may be more granular than needed for some forms of pedestrian navigation.The value of this property must be at least DirectionsPriority.lowand at mostDirectionsPriority.high. The default value ofDirectionsPriority.defaultneither prefers nor avoids walkways, while a negative value betweenDirectionsPriority.lowandDirectionsPriority.defaultavoids walkways, and a positive value betweenDirectionsPriority.defaultandDirectionsPriority.highprefers walkways. A value of −0.1 results in less verbose routes in cities where sidewalks and crosswalks are generally mapped as separate footpaths.DeclarationSwift open var walkwayPriority: DirectionsPriority
- 
                  
                  The expected uniform travel speed measured in meters per second. This property has no effect unless the profile identifier is set to DirectionsProfileIdentifier.walking. You can adjust this property to account for running or for faster or slower gaits. When the profile identifier is set to another profile identifier, such asDirectionsProfileIdentifier.driving, this property is ignored in favor of the expected travel speed on each road along the route. This property may be supported by other routing profiles in the future.The value of this property must be at least CLLocationSpeed.minimumWalkingand at mostCLLocationSpeed.maximumWalking. The default value isCLLocationSpeed.normalWalking.DeclarationSwift open var speed: CLLocationSpeed
- 
                  
                  A Boolean value indicating whether alternative routes should be included in the response. If the value of this property is false, the server only calculates a single route that visits each of the waypoints. If the value of this property istrue, the server attempts to find additional reasonable routes that visit the waypoints. Regardless, multiple routes are only returned if it is possible to visit the waypoints by a different route without significantly increasing the distance or travel time. The alternative routes may partially overlap with the preferred route, especially if intermediate waypoints are specified.Alternative routes may take longer to calculate and make the response significantly larger, so only request alternative routes if you intend to display them to the user or let the user choose them over the preferred route. For example, do not request alternative routes if you only want to know the distance or estimated travel time to a destination. The default value of this property is false.DeclarationSwift open var includesAlternativeRoutes: Bool
- 
                  
                  A Boolean value indicating whether the route includes a ManeuverType.exitRoundaboutorManeuverType.exitRotarystep when traversing a roundabout or rotary, respectively.If this option is set to true, a route that traverses a roundabout includes both aManeuverType.takeRoundaboutstep and aManeuverType.exitRoundaboutstep; likewise, a route that traverses a large, named roundabout includes both aManeuverType.takeRotarystep and aManeuverType.exitRotarystep. Otherwise, it only includes aManeuverType.takeRoundaboutorManeuverType.takeRotarystep. This option is set tofalseby default.DeclarationSwift open var includesExitRoundaboutManeuver: Bool
- 
                  
                  A Boolean value indicating whether Directionscan refresh time-dependent properties of theRouteLegs of the resultingRoutes.To refresh the RouteLeg.expectedSegmentTravelTimes,RouteLeg.segmentSpeeds, andRouteLeg.segmentCongestionLevelsproperties, use theDirections.refreshRoute(responseIdentifier:routeIndex:fromLegAtIndex:completionHandler:)method. This property is ignored unlessprofileIdentifierisDirectionsProfileIdentifier.automobileAvoidingTraffic. This option is set tofalseby default.DeclarationSwift open var refreshingEnabled: Bool
- 
                  
                  DeclarationSwift override open var urlQueryItems: [URLQueryItem] { get }
 Install in Dash
              Install in Dash
             RouteOptions Class Reference
        RouteOptions Class Reference