Piotr Smajek
Jul 26 · 5 min read

Siri shortcuts, a new feature presented at last year’s WWDC, offer the ability to perform certain functionalities of the application in the background. We do not have to turn on the application to use these functionalities in the application, we can simply say to Siri, e.g. “Burger Time” and the system knows to which application this shortcut is assigned and orders a burger for us. 😀

A short description of Siri Shortcuts 📝

  • A convenient way to accomplish tasks from the lock screen or search area.
  • Shortcuts can also be added to Siri to run with a voice phrase on iOS, HomePod and watchOS.
  • Developers add shortcut hooks into their apps that enable Siri to connect to these shortcuts.
  • Using ML models of your behavior to analyze common functions that you perform and suggest shortcuts automatically.
  • iOS 12+

In this article we will focus on the implementation of the order shortcut, one of the most popular applications of Siri Shortcuts. We will create a simple application that will allow you to order burgers 🍔

How can we create a shortcut? 🤔

Correct path to create Siri Shortcut
  1. At the very beginning, we have to think about the functionality which the user really wants to make easier in our application. This should be a functionality that the user performs frequently and requires the user to enter the application and pass a long path in it. Shortcuts will enable shortening this path to perform the functionality.
  2. In the next step, you need to donate a shortcut. What does this mean? We must pass the information to the system about the fact that we have placed an order, for example one burger with bacon. We provide this information to the system and later Siri can suggest us at a specific time to make this specific order.
  3. The last thing to do is to handle this shortcut, which happens when the user tells Siri the command defined earlier, e.g. “Burger time”, or in the case when the user presses the shortcut suggested by Siri on the lock screen.

Ok, maybe we’ll write some code? What are our possibilities as developers? 👨‍💻

NSUserAcvitity — We will create a shortcut that will let us launch the screen for making a new order

  1. Add the key to Info.plist

2. Donate the shortcut when the user enters the screen

3. In the AppDelegate, you must implement continueUserActivity delegate which, after getting this particular type, will redirect to the given screen

Intents- We will implement a shortcut to make orders

Pro tip before implementation
Intentions appear when the user does something systematically. However, when you want to test this functionality so that you always get a suggestion from Siri, you must enable two options — “Display Recent Shortcuts” and “Display Donations on Lock Screen” in Settings -> Developer.

  1. Create an intent definition file. The best way is to add it to a separate framework in my project it will be in OrderKit.
File -> New -> File… -> SiriKit Intent Definition File

2. Select a category, in this case “Order”. In this file we have to choose the parameters that we will pass to the system and create combinations of these parameters.

Order definition — create custom intent
Order definition — Define responses

3. Create a new target with an extension for intentions, select “Include UI Extension” when you are creating it.

File -> New -> Target… -> Intents Extension
This is what the Target Membership should look like for Order.intentdefinition

4. Create a UI for intent in the MainInterface.storyboard file.

Creating UI for our Intent

5. Configure ready and success state in inIntentViewController.

6. After creating the UI, we can go to the donate of our intention. In this case, it is best to donate intentions when placing the order. We provide all the information to the system that we previously defined in the file Order.intentdefinition, i.e. burger name, quantity and additions, and the proposed phrase displayed in the case when we would like to immediately add this shortcut to Siri when placing the order.

7. Now we can handle the situation what is going to happen in the case when the user gets the suggestion of a shortcut and clicks on it and in case the user calls the shortcut by Siri.

That’s all, everything works 🎉🎉🎉

You can check the whole project on my GitHub here:


Miquido News

Publication on everything mobile, featuring future-forward ideas on software development, product design, research and development and digital transformation of businesses.

Piotr Smajek

Written by

iOS Developer @miquido

Miquido News

Publication on everything mobile, featuring future-forward ideas on software development, product design, research and development and digital transformation of businesses.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade