When you create an intents extension, Apple provides a template for a Siri app. This movie shows how to use that template to test Siri features in a custom messaging app.
- [Instructor] So now let's actually test the app on a device and see what Apple gives us right out of the box, with this sample messaging application. So I've already installed the app on my device, and I've already authorized Siri for the application so those are crucial steps before we get this to actually work. So what to do is we go to our scheme here, and we change the scheme to our intent. And this method that I'm showing you is going to make it so that the intent installs on the device.
And that is necessary. If we do this in just the right way, we can get output in the debugger for both our main application and our intent. So I'll hit the run button. I'm running that app intent on my device, and then what I'm doing is I'm going to choose the application that I want to run. to choose the application that I want to run. And remember that's called Todd's App. So I select that and then hit run. Now if I just run the app intent and I choose Siri for the app, it'll still run. It'll still print to the debug menu when I run that but it's only going to give me the intent handler swift file.
So anything that's in my intent is going to apply. But the things that are outside of that are not so that's why I attach it to my existing app. So I'm seeing Siri has authorized so that's showing that my app is running. And I'll tell Siri to send a message. Send a message with Todd's app. - [Siri] Who do you want to send it to? - [Instructor] Herman. - [Siri] What do you want to say? - [Instructor] This is a message, period. - [Siri] Ready to send it? - [Instructor] Yes. - [Siri] It's sent. - [Instructor] So I sent a message to Herman, who's a fictional contact. I intentionally chose a name of somebody that's not in my contacts on my phone because I didn't want to confuse them or reveal names of people that I know to the world and so here I have to Herman and so here I have to Herman and then we have the message content.
And we also have this big white rectangle right in the center and what that is is that's your user interface that you can design in the app intent UI storyboard. So let's say we have a picture of this Herman character and we put him inside of there. So if we're sending a message to Herman, we want to show his face right there. Maybe we want to have information about the message or show whatever we want to show, remembering that it cannot be interactive but we can show this data and we can get the data from Siri to present it there.
But this is the default implementation. This is what Apple gives us right out of the box without having to do anything. I'll stop the app and return to Xcode. So remember if you want to get output in the debug area for both your application and your intent, run your intent and choose to run it with your existing installed application and then you can get the print statements for both.
- Setting up SiriKit in a project
- Authorizing Siri for your app
- Testing the default SiriKit app
- Writing simple payment handling code
- Resolving, confirming, and handling intents
- Sending data from Siri to your app
- Using a photo intent to search for photos
- Reviewing Siri support in photo apps, VoIP calling apps, ride apps, and workout apps