How to Extend Your iOS App With SiriKit

DZone 's Guide to

How to Extend Your iOS App With SiriKit

Learn how to integrate the new SiriKit which enables third-party apps to work with Siri, so you can use voice commands to book an Uber, send a message, and more.

· Mobile Zone ·
Free Resource

Apple phones have always been popular, the reason being their great looks and amazing functionality.  Lately, Apple announced its latest innovative SiriKit, which simply enables third-party apps to work with Siri, and users are only required to give voice commands to get things done. Now Siri can become your own super-efficient and customized personal assistant. Although there are a few restrictions on getting things done with the integration, it does offer ease to users. Let us gain insight on how your apps can be extended with SiriKit.

Which Apps Can Be Integrated Using SiriKit?

As mentioned earlier, SiriKit has few restrictions. You can make Siri to take voice commands to run apps only if they have any one or more of the following domain

  • Voice calling (e.g. Skype)
  • Messaging (e.g. Whatsapp, Wechat)
  • Payments (e.g. PayPal)
  • Ride booking (e.g. Uber)
  • Photos (e.g. Photos)
  • Workout (e.g. Runtastic, Jefit)

Looking at the domains, you can figure out the types of commands you can give to Siri. For example, Book Uber to Cineplex at 6 pm, Pay George $20 by PayPal, or Whatsapp Nicole "Good morning."

With the above six domains, Siri has intents or known actions to communicate with apps.

Types of Intents

There are basically two types of intent- intent extension, which is responsible for handling user requests, and IntentUI, which is necessary only if you wish to customize the way data is presented to you.

How to Add SiriKit

Step 1- Open your app project in Xcode.

Step 2- Go to project settings and select the iOS app target.

Step 3- Go to capabilities tab and enable Siri capability.

How to Add Intent App Extension

  • Open the app project in Xcode.
  • Click on File> New> Target.
  • From the application extension group, select "intent extension."
  • If you wish, you can name the extension and edit the language.
  • If you wish to customize the look, you can enable the IntentUI extension from the application extension group.
  • Click "Finish."

Note: You can find several intents in the application intent tab, but make sure you add few which are supported, as it can affect performance and memory consumption.

How SiriKit Intents Work

There are three levels of communication for intents to work:

  • Resolve: This is the step where an application deciphers what command the user has given.
  • Confirm: At this stage, Siri takes an action like asking permission before completing a task, or authenticating the user.
  • Handle: A few commands, like "make a Skype call to Harvey," can take a little time, as it depends on the network, so during the waiting time, Siri will show a wait animation.

Let's See an Example to Understand Intents Better

Suppose you asked Siri to book a ride through Uber.

Resolve stage: Siri will listen and decipher what she needs to do. Siri will then interact with the Uber app and pass the "request ride" command.

Confirm Stage: Once Siri checks the availability, she will prompt you with some message, like "A cab is available in five minutes, shall I book it?" This is where the user needs to authenticate and reply with a yes or no.

Handle stage: Once the order is confirmed, the handle method is triggered as the task will take a while to perform. All these actions happened without the user's need to click on the Uber app and book a ride.

Sirikit can altogether make the user feel at ease and enjoy a much more interactive interface. Any application with the SiriKit integration can be very popular.

Visit Our Website To Develope Your App: Potenza Global Solutions

integration, ios, mobile, mobile app development, siri, sirikit

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}