https://cdn-images-1.medium.com/max/2000/1*bhonbY4jHhFNGXzBkodmbw.png In my I talked about how you can quickly create a Siri Shortcut using NSUserActivity. NSUserActivity is great for scenarios where you want to open your app through . In more advanced scenario, where you want finer control over the Shortcuts experience it is recommended that you use . last post Shortcuts Intents In this post I will show you how you can get started with Intents and how you can setup intents definition file which serves as the blueprint for your Siri Shortcuts. What are Intents? Intents allows you to have finer control over Shortcuts. This means instead of Siri saying “ ” Your coffee has been ordered and it will arrive at a location Siri can say something more meaningful like “ ” Your cappuccino has been ordered and it will arrive at your office in 10 minutes Intents can also be used to create custom responses and even a custom user interface which will allow users to place their order without even opening the app. Don’t worry too much about custom user interface for intents for now, I will cover that in the next post. Defining your Intents: Intents are defined in an Intents definition file. Add a new file to your project and search for “intents” in the search bar. Select the “ ” as shown below: SiriKit Intent Definition File By default the Intents file is empty. Click on the “+” sign in the bottom which adds a new intent. Rename the intent to “ ” from its default name. OrderCoffee Intents definition file is divided into multiple sections. Let’s start with “ ” section at the top. This is where you define the name of your intent, description, category and the default image. Custom Intent Since, our app is responsible for ordering coffee that is why we selected the category as “ ”. The Confirmation checkmark is checked indicating that user confirmation is required in order to execute this intent. Order Next, we will setup the parameters for your intent. Parameters is the additional data you can pass to the intents. Parameters are also used by Siri when used with Siri Voice Shortcuts. We are using two parameters and . One important thing to notice is that the deliveryLocation is of type Location and not String. This means we can even use it to calculate the estimated time of arrival. coffeeName deliveryLocation You can also use your custom classes as Parameters. In those cases the Parameter type will be custom. Finally, we will set “ ”. Shortcut Types allows Siri to learn more about your Shortcut behaviors. Shortcut Types really depends on the app and should be defined in a way which makes sense. In our app we are defining two shortcut types so Siri can learn the behavior when coffee and location is available and also when the location is not available. Shortcut Types Go ahead and build your application. Behind the scenes Xcode will look at the Intents file and create a corresponding Swift class “ ”. In the next section we will learn how to donate our intents. OrderCoffeeIntent Donating Intents Finally, the time has come to donate our intents. We start by creating a placemark instance which represents, where the coffee needs to be delivered. This can be done by using the CLLocation and CLPlacemark classes as shown below: Next, we will create an instance of class, which was automatically generated by the Intents Definition File. OrderCoffeeIntent Finally, we will donate our intent using the INInteraction instance as shown below: That’s it! Next run the app and donate your intent. After you have donated the shortcut you should be able to see your donations under “ ” as shown below. Siri App Suggestions Nice! In the next post we will take our app to the next level by implementing a custom user interface for your shortcut. This will allow us to place an order for coffee without even opening the app. Mastering Siri Shortcuts for iOS If you have enjoyed this post and want to learn more about Siri Shortcuts then check out my 3+ hour Udemy course “ ”. The course goes into much more detail in how to create Siri Shortcuts using NSUserActivity, Intents, Custom Responses, Custom User Interface and much more. Mastering Siri Shortcuts in iOS _Streamline the things you do often with shortcuts_www.udemy.com Mastering Siri Shortcuts in iOS | Udemy