INRequestRideIntentHandling
The handler interface for booking a ride for the user.
Declaration
protocol INRequestRideIntentHandling : NSObjectProtocolOverview
Use the methods of the INRequestRideIntentHandling protocol to resolve, confirm, and handle requests to book a ride using your service. Adopt this protocol in an object of your Intents extension that is capable of initiating the booking process with your service. SiriKit calls the methods of your object to resolve the parameters to your ride-related information and to book the ride upon confirmation by the user.
Ride requests have many items to resolve. You should resolve all options in some manner, but you may omit options that are not relevant to your service. For example, if your service transports cargo instead of passengers, you might ignore the party size option. For ride requests, you must resolve the following items:
Pickup location
Drop-off location
Party size
Ride option
Payment method
Handling a Ride Request
Handling a ride request involves booking the ride with your service and providing SiriKit with the status of the booking. The details of how you book rides through your service are up to you. You need to schedule the ride, find a vehicle and a driver, and arrange payment from the user. The INRequestRideIntent object contains information about what the user needs. Pass the information in that object to your service and use the results to configure the response object you return to SiriKit.
The code listing below is an example of how you might book a ride and provide a response. Because booking the actual ride is a custom process, the example calls several custom methods to implement key phases of that process. The first of these methods uses information from the intent object to register the request with a fictional service and retrieve an ID string identifying the request. Use that ID string to retrieve specific information from the service regarding the vehicle type, driver, and ride option. Use all of the retrieved information to build the INRideStatus object that and add the status object to the INRequestRideIntentResponse object passed back to SiriKit.
When creating responses, providing an NSUserActivity object is optional and necessary only when you want to include custom information for your app. If you specify nil, SiriKit creates a user activity object for you as needed. For more information on configuring the response object, see INRequestRideIntentResponse.
Topics
Resolving the Intent Parameters
resolvePickupLocation(for:with:)resolveScheduledPickupTime(for:with:)resolveDropOffLocation(for:with:)resolveRideOptionName(for:with:)resolvePartySize(for:with:)