Introduction to SiriKit
SiriKit lets you integrate your app’s content and services with the system. As its name implies, SiriKit is used most prominently to support Siri, giving users the ability to control your app’s behavior using their voice. However, Maps also uses SiriKit to integrate data from specific types of apps into the overall Maps experience. In both cases, the process for adding SiriKit support to your app is the same.
SiriKit is comprised of two frameworks, which you use to implement app extensions. The Intents framework supports the fundamental communication between your app and the system. You use that framework to define the types of tasks you can perform and to handle those tasks when asked to do so. The Intents UI framework provides optional support for presenting a custom interface when one of your tasks is performed on an iOS device.
SiriKit support is divided into domains, each of which defines one or more tasks that can be performed. In order to support SiriKit, apps must support one of the following domains:
CarPlay (automotive vendors only)
Restaurant reservations (requires additional support from Apple)
Each domain defines one or more tasks that an app can perform. These tasks are known as intents because they represent the intentions of the user, and each intent is represented by a custom class whose properties contain information related to the task. For example, intents in the Payments domain contain properties with the amount of money to transfer and the users involved in the transaction. When a user makes a request through Siri or Maps, the system fills an intent object with the details of the request and delivers that object to your app extension. You use the intent object to validate the request data and perform the associated task.
The Intents and Intents UI App Extensions
You add support for SiriKit through two different types of app extensions:
An Intents extension receives intent objects from the system and performs the associated tasks. This extension is required.
An Intents UI extension lets you customize the appearance of the Siri or Maps interface after an intent has been handled successfully. This extension is optional in iOS; it is not supported in watchOS.
The system launches and runs both extensions only when they are needed, and both extensions have a well-defined set of interactions that must be supported. All apps that support SiriKit must have an Intents extension. Providing an Intents UI extension is optional but is a good way to provide a familiar experience for your users.
How Siri and Maps Handle Requests
Siri and Maps manage user requests by gathering the needed data and turning them into intents objects for you to handle. In Siri’s case, Siri handles all of the natural language processing required to turn spoken requests into valid data in an intent object. Because spoken requests might not contain enough information initially, Siri works with your Intents extension to verify that you understand what the user meant and that you have the data you need. During this validation process, you might ask Siri to confirm certain details with the user. Throughout the process, Siri manages all interactions with the user, leaving you free to focus on the data itself.
The Maps app in iOS similarly manages all interactions with the user. Because Maps supports only the domains related to ride booking and restaurant reservations, its user interface is able to focus on making those tasks easy. In Maps, users select what they want directly, rather than asking for it verbally. The result is that intents originating from Maps are less ambiguous and need less validation, which simplifies the handling process for those intents.
Maps on watchOS does not interact with your Intents extension.