Much Awaited Siri Shortcuts
Apple has given a new gift to the iOS developers in WWDC 2018, where they have introduced Siri shortcuts in front of the world. The developers have been waiting for the Siri Shortcuts for a pretty long time now. Previously used Sirikit SDK was limited in functionality which has tied downed developers hands in the field. It is expected that with the new Siri shortcuts developers can create an augmented app and can even insert voice control features in the apps also.
History of Siri Shortcuts
The evaluation of Siri Shortcuts basically means automation. In fact, Siri Shortcuts evolved out of Workflow, an iOS automation app built by former WWDC scholars. Apple kept this app on the App Store under an uncanny move. The inspiration of the Siri shortcuts is heavily taken from the Workflow app.
Numerous features of the Workflow app has helped in the development of Siri Shortcuts. But, guys, it’s important to differentiate between the shortcut app from the shortcut voice cuts. Whereas the shortcuts apps enable users to set short voice phrases for the daily tasks. On the other hand, Siri shortcuts provide the tool to the developers to add voice control to their native apps.
Okay, so in this post, we will narrate you the story of a simple app launch using the Siri shortcuts. Yep, if you have ever dreamt that simply saying “Hello” can launch your app. Then, with Siri shortcuts, this task can be achieved without any hitch. For this you won’t have to perform some hard number crunching or code generating, just simple utilization of Siri shortcuts can be your helping tool.
Designing Your Siri Shortcuts
Okay, so before starting your new project always make sure that you have all the required tools ready with you. For this particular project, you required iOS 12, macOS Mojave, and Xcode 10. If you don’t have any of these tools, then you won’t able to work with Siri shortcuts because it runs on the new API of iOS 12 only. But, if you are a certified iOS developer, then you don’t have to worry as from the developer’s site you can easily download the tools.
Now, start the Xcode and start a new project with your desired name. You have to also identify the organization identified in the project. After that click on the load and then your new project will be created.
Foremost, you have to navigate to the Project Settings section of your Xcode project, select Capabilities, and scroll down, and make sure you enable Siri. This enables you to use Siri SDK in your app.
Once Xcode has enabled Siri in your project, it will create .entitlements file in your project. You have to scroll down to the General Tab and look at the bottom and select the Linked Frameworks and Libraries. Here make sure to click on the + button to add frameworks to the project. Look for Intents. Framework and add it to your project. This will enable you to add new Intents to your application.
In the last, you have to Info.plist file and add an NSUserActivityTypes dictionary with a key-value pair. The value of your first item should contain the value of your bundle identifier such as “Hello”.
Now, our basic project is ready, but to actually create the shortcuts you have to define them. In order to make your shortcut available to your users via Siri, we leverage a process called “Donating Shortcuts.”
According to official app developer documentation, you should donate shortcut every time user made shortcut request. Like, if someone has ordered pizza using your shortcut, then you should donate this shortcut. Otherwise, there is no requirement to add a shortcut for the pizza order.
Well, donating the new shortcut might require some level of coding, but this a very deep subject itself. So, we are going to leave it for some other day. Meanwhile, keep reading about the Siri shortcuts.