A utility object that computes directions and travel-time information based on the route information you provide.
- iOS 7.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.2+
You use an
MKDirections object to ask the Apple servers to provide walking or driving directions for a route, which you specify using an
MKDirections 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.
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
MKError error if too many requests have been made from the current device in too short a time period.