A utility object that computes directions and travel-time information based on the route information you provide.


You use an MKDirections object to ask the Apple servers to provide walking or driving directions for a route, which you specify using an MKDirectionsRequest object. After making a request, MapKit delivers the results asynchronously to the completion handler that you provide. You can also get the estimated travel time for the route.

Each MKDirections object handles a single request for directions, although you can cancel and restart that request as needed. You can create multiple instances of this class and process different route requests at the same time, but you should make requests only when you plan to present the corresponding route information to the user. Apps may receive a loadingThrottled error if too many requests have been made from the current device in too short a time period.


Initializing a Directions Object

init(request: MKDirectionsRequest)

Initializes and returns a directions object using the specified request.

Getting the Directions

func calculate(completionHandler: MKDirectionsHandler)

Begins calculating the requested route information asynchronously.

func calculateETA(completionHandler: MKETAHandler)

Begins calculating the requested travel-time information asynchronously.

func cancel()

Cancels a pending request.

var isCalculating: Bool

A Boolean value indicating whether a request is currently in process.


typealias MKDirectionsHandler

The block to use for processing the requested route information.

typealias MKETAHandler

The block to use for processing travel-time information.


Inherits From

Conforms To

See Also


class MKMapItem

A point of interest on the map.

class MKDirectionsRequest

The start and end points of a route, along with the planned mode of transportation.

class MKDirectionsResponse

The route information returned by Apple servers in response to one of your requests for directions.

class MKETAResponse

The travel-time information returned by Apple servers.

class MKRoute

A single route between a requested start and end point.

class MKRouteStep

One portion of an overall route.