MKDirectionsRequest class is used by apps that work with turn-based directions. When the Maps app sends a directions-related URL to your app, you use this class to decode the URL contents and determine the start and end points of a route. You then use that data to compute the actual route and display the results to the user. For apps that want to supplement their own routing directions, you can also use instances of this class to specify route information that you want from Apple.
- iOS 6.0+
- macOS 10.9+
- tvOS 9.2+
For apps that provide directions, upon receiving a URL in your app delegate’s
application(_:open:sourceApplication:annotation:) method, use the
isDirectionsRequest(_:) method of this class to determine if the URL is related to routing directions. If it is, create an instance of this class using the provided URL and extract the map items associated with the start and end points. You can then use those points to begin your route planning.
You can use this class to request directions for modes of transportation that your app does not natively handle. For example, an app that provides subway directions might request walking directions to and from relevant subway stations. To request directions, create a new instance of this class and configure it with the new start and end points you need. Then create a
MKDirections object and use the methods of that class to initiate the request and process the results.