NavigationDirections
public class NavigationDirections : Directions
A NavigationDirections
object provides you with optimal directions between different locations, or waypoints. The directions object passes your request to a built-in routing engine and returns the requested information to a closure (block) that you provide. A directions object can handle multiple simultaneous requests. A RouteOptions
object specifies criteria for the results, such as intermediate waypoints, a mode of transportation, or the level of detail to be returned. In addition to Directions
, NavigationDirections
provides support for offline routing.
Each result produced by the directions object is stored in a Route
object. Depending on the RouteOptions
object you provide, each route may include detailed information suitable for turn-by-turn directions, or it may include only high-level information such as the distance, estimated travel time, and name of each leg of the trip. The waypoints that form the request may be conflated with nearby locations, as appropriate; the resulting waypoints are provided to the closure.
-
Configures the router with the given set of tiles.
Declaration
Swift
public func configureRouter(tilesURL: URL, completionHandler: @escaping NavigationDirectionsCompletionHandler)
Parameters
tilesURL
The location where the tiles has been sideloaded to.
completionHandler
A block that is called when the router is completely configured.
-
Unpacks a .tar-file at the given filePathURL to a writeable output directory. The target at the filePathURL will be consumed while unpacking.
Declaration
Swift
public class func unpackTilePack(at filePathURL: URL, outputDirectoryURL: URL, progressHandler: UnpackProgressHandler?, completionHandler: UnpackCompletionHandler?)
Parameters
filePathURL
The file path to the .tar-file.
outputDirectoryURL
The output directory.
progressHandler
Unpacking reports progress every 500ms.
completionHandler
Called when unpacking completed.
-
Begins asynchronously calculating the route or routes using the given options and delivers the results to a closure.
This method retrieves the routes asynchronously via MapboxNavigationNative.
Routes may be displayed atop a Mapbox map.
Declaration
Swift
public func calculate(_ options: RouteOptions, offline: Bool = true, completionHandler: @escaping OfflineRouteCompletionHandler)
Parameters
options
A
RouteOptions
object specifying the requirements for the resulting routes.offline
Determines whether to calculate the route offline or online.
completionHandler
The closure (block) to call with the resulting routes. This closure is executed on the application’s main thread.