In this tutorial you will learn how to get SiriKit working in your iOS App! To learn more about how SiriKit works behind the scenes, check out this article!
Requirements: Xcode 8, Swift 3 Project (this is what the tutorial is built on)
Part 1. Getting a quick and simple demo running
Create & setup iOS app
- Create a new ‘Single View Application’ Xcode Project. For this tutorial, lets use the project name “SiriKitDemo”
- Once the project is created and opened up, select your iOS app target in project settings.
- Enable the Siri capability under the “Capabilities” tab
Now its time to add the intent files to your project
4. Select File –> New –> Target
5. Select “Intents Extension”
6. Click Next and specify the name of your extension and configure the language and other options. ***For this tutorial, Check “Include UI Extension”***
Request access to Siri
7. Include the NSSiriUsageDescription
key in your iOS app’s Info.plist
file. The value for this key is a string that describes what information your app shares with SiriKit
8. Open up your ViewController.swift file, import Intents and under viewDidLoad, call the requestSiriAuthorization:
class method of INPreferences
Running & Testing
9. Select your iOS app’s target & Run your application
10. Select your Intent Extension and run that by attaching it to your iOS app
11. Activate Siri and say “Search for messages in <appname>” —Siri should respond with what is listed in the IntentHandler.swift file
***Sometimes it takes a few minutes for Siri to process your extension, if it doesn’t work right away, don’t be alarmed***
Want to get a little bit more in depth? Learn how to add more intents, customize the way Siri handles intents, & more in Part 2!
[wpdevart_like_box profile_id=”364745913648633″ connections=”show” width=”300″ height=”550″ header=”small” cover_photo=”show” locale=”en_US”]