Adding Siri Support to Your iOS App | Lou Franco | Skillshare

Adding Siri Support to Your iOS App

Lou Franco, Software Developer

Adding Siri Support to Your iOS App

Lou Franco, Software Developer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
20 Lessons (51m)
    • 1. Introduction

    • 2. Intro to SiriKit

    • 3. The Notes and Tasks Intent

    • 4. How to Add an Intent Extension to an App

    • 5. Creating the Extension Profile in the Apple Dev Website

    • 6. Creating the Intent Extension in Xcode

    • 7. Setting up the App Groups

    • 8. Overview of Code to be Written

    • 9. Create Intent Handler for a New Task

    • 10. Connecting the Handler

    • 11. App Parameters

    • 12. Testing Siri

    • 13. First Workbook

    • 14. iOS 12 Custom Intents

    • 15. Second Project Overview

    • 16. Implement Handler

    • 17. Update Extension Plist to Configure Handler

    • 18. Test New feature

    • 19. 2nd Workbook

    • 20. Conclusion

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

In this class, you will learn how to add Siri support into an existing app. Siri is Apple’s voice assistant and using SiriKit, you can teach Siri how to let users control your app with voice.

You will start with List-o-Mat, an open-source to-do list app. We’ll go through each step of adding support for iOS’s built-in Siri support and then explore and implement iOS 12’s support for custom Siri Shortcuts.

You'll get the most out of this class if you already know Swift and how to use Xcode.

Meet Your Teacher

Teacher Profile Image

Lou Franco

Software Developer


Software product development veteran with over 25 years of experience developing software for financial institutions, enterprise software companies, and start-ups.

I have been developing for iOS since 2008, and I'm currently on the Trello iOS development team at Atlassian.

You can contact me at

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.



1. Introduction : This is the introduction to Sirikit skills share. Of course, in this course, we're going to learn about Sirikit and how to add Sirius support into your own apse. My name is Lou Franco. I've been an IOS developer since 2008 and on the author of Hello IOS Development and a contributor to Smashing Magazine. To do this course, you should be familiar with IOS development. We're not going to cover view, controller, storyboards or swift, but instead we're going to you be using a pre built app and just learning about the Sirikit parts. By the end of the course, you'll know about Syria kits built in domains and intense and whether they will work with your app. For more complex situations, you'll learn about custom intense, which will work with just about any app and integrate with Iowa's 12 new shortcuts. There are two workshops Will. You'll apply what you've learned, and we hope you'll share your work with us by posting a link. You're get Hub Fork, of course, Repository. Let's get started 2. Intro to SiriKit : welcome to the introduction to Sirikit Skill Share course to start, Let's talk about the history of Siri. Not many people know this, but Syria was originally 1/3 party app that was introduced in February of 2010. Apple was so impressed that acquired this out just two months later, and at the following WWDC in 2011 it was integrated into IOS five. Apple added Sirikit IOS in 2016. This allows developers like us to create our own Siri experiences using Apple's built in phrases or intense. And it was in Iowa's 12 in 2018 that Sirikit was extended to include custom, intense and shortcuts. There are some things that Syria is very good at when you're on the go, and it's not easy to use your phone. You can use Siri to get directions or book a ride, or when things require a lot of typing. Syria's good for answering a text or setting a reminder and serious also available directly from the maps app. So anything you'd want to do in maps is good to do with Siri's, such as making a restaurant reservation or getting directions or rides. The's use cases are broken down into something that Apple calls domains. Domains are groups of related actions that you can do in Syria, for example, booking a ride, making new lists and notes, starting workouts or messaging someone. Each of these is a domain, and there are many more. You can see the full list in Apple's developer documentation. Each domain has a list of intense and intent is a specific action for Syria to before in the ride booking domain, you can request a ride or find out where your car is on a map in the list and notes domain . You can make a task list, add task to it or make new notes. And in the workouts, Tomei you can start or end a workout. Let's take a deeper look at the ride booking domain. It has an intent to request a ride. This intent has parameters such as your pickup and drop off location or your party size. It also has a ride status intent. This one can be invoked directly by the maps app instead of by voice, and the results are shown right on the map. Or you can cancel a ride which knows about the context your current ride parameters, context and app integration or things that apply to intense in all domains. So to recap, Sirikit was introduced in 2016. It was extended in 2018 to include custom, Intense. Sirikit itself is organizes a collection of domains and intense and domains are groups of related requests. And intense are the specific requests an intent may have parameters that need to be resolved in the following lessons. We'll talk more about the lists and notes still made because we'll be adding support for some of its intense into an existing app. Specifically will add the at a task intent, which allows you to add a task to a task list and then in a workshop, you'll add the search for items intent on your own. Let's get started. 3. The Notes and Tasks Intent: Okay, now we're going to talk about the lists and notes Dough made This dough made has intense for working with lists, tasks and notes, the built in reminders and notes. APS used this domain. So if you've set a reminder with Siri you've used using intense in this domain, you can create a pen to and search for a note or search for a task list or single task or create a new list, add a task to it or edit an existing task. See the developer documentation for a full list of intense so that we can concentrate on Onley Sirikit. I've prepared an app called Mr Matt that we can use as a baseline. It's a very simple app that implements to do lists you can add and delete lists and add the lead and check off items it's on. Get hub, and I'll show you how to get to it soon. The intent we're going to add is the one to add a test to a list. A sample phrase might be. Add orange juice to the grocery store in list on that. This intent has two parameters. We care about the type of the item in our case, a task on the title of the item, which was orange juice. In this example. We're not going to look at the completion, status, date or location in this course, but this is something you could try on your own in a workshop. I'll give you some guidance for adding support for searching for a task list. A sample phrase here is Show me my grocery store tasks and list on that. You'll do this one on your own, and we hope you'll share it with us. I'm get help. It will also have the parameters of type entitled. But before we can start coating, I have to talk a little bit about Syria kids. Intense extension, which is how we support Syrian our app. Don't worry if you've never done in Iowa's extension before, because I'll cover the basics, including the configuration on the developer site. Then we'll configure the extension and write the code to support the add a task intent 4. How to Add an Intent Extension to an App: now we're going to talk about the intense extension and intense extension is a type of Iowa's extension. There are many others, such as today screen widgets, custom keyboards and their photo editing and share extensions as well. They're one of the ways your app can interact with other APS and IOS itself. The main thing you need to know is an extension is code that runs outside of your app, usually by some other IOS app. In our case, our extension is run by Siri. You can think of it as its own little app separate from your main one, so it needs its own app i D and profiles, which you configure on the Apple Developer website. But when you make an I pay archive, your app and all of its extension until they put inside of it for you to upload to the APP store as one file toe at an intense extension to list on that first will configure it on the developer site. Then we'll need to set up an APP group so that our app an extension can communicate with each other finally will go to X code and add the intense extension target to our projects on the developer site. We'll create an APP i D, and we'll give it the Syrian title man. Then we'll create an APP group for the app and extension. Let's talk a little bit more about APP groups. Remember your app. An extension are run by Iowa Separately. They also have their own sandboxes and can't see each other's files to help APS and extensions made by the same developer interact with each other. Apple provides APP groups. They offer many features, but the thing we need is the shared sandbox. We only use it to store our to do list file so that our extension and app can both see them . The last step we need to do before coating is to go to X code and add the extension target . Once we do, we just need to do a little configuration in its P list. So it knows about the APP group we created. Then we can add or intent handler code to it. Now that we have the general idea, we can go ahead and do it. I'll walk you through the configuration and target creation. Then we'll write the code toe handle the intent 5. Creating the Extension Profile in the Apple Dev Website: follow the link in the notes to the get hub repository for listing. The master branch has the final project completed, so we'll use the skill share starting Point Branch, which has list Amat without any Sirikit it. Copy this address so you cloned onto your computer and then in a terminal weaken type, get clone and paste that address. And then I'll CD into the list of that directory and get check out skill share Dash starting dash point. And now I can open the X Code Project Open list on that dot Exco Abraaj and I'll choose the iPhone 10 simulator and we'll run it just so I can show you what list of that can dio Lister. Matt is a very simple to do list manager, so all I can add lists, for instance, a grocery store list. And then I'll add another ah hardware store list. I'll go into the hardware store and add Hammer as an item to get and in the grocery store, I'll add eggs and though ad bread and we'll add another list. Books to read will use thes lists and items in the lessons later. I could delete a list I could go into a list and check and uncheck items or delete items. And all of these are things that we could do with Syria's. Well, let's go over to me Apple to have website and at an app group. So choose at groups on the left and hit the plus. I'm going to name it Listo Matt Group skill share and I'm gonna give it the i d group dot com dot do franco dot listo Matt, you should use your name instead of Loo Franco here. Hit writer, sir and done. And now go to the app ID's section so we can make an AB i d for the AB itself. I'll call that list Oh, Matt, Skill share and I'll give it the bundle i d com dot liu franco dot listo Matt And again, you should use your name. Not Lou Franco There. I'm gonna check app groups and Sirikit in the services below. And then he'd continue and then register. And then well hit Done will click the exact app idea we just made and we'll see that app groups are configurable Will edit, edit the ad groups and then check the box for the one we made for this. The list of Matt Group skill share for me. You should only have one group. Then we'll make another app. I d. This time we're making one for the intent handler. The intent target called listo Matt. Intense skill share and com dot liu franco dot listo matt dot listo Matt intense again. You'll use your name instead of loo Franco. We'll check APP groups and Sirikit again and just like before After we save it, we're going to go right back into it and added it so that we can set the apurate. Excellent. So now we can go back into the X Code project and click on the Project node. And on then, on the list of Matt Target, If you type bundle in the surge, you'll see that you can see the old bundle ideas. You change it to your name. I'm gonna put Blue Franco here, but you should use your name, the one you just put into the Apple Developer site. And now I'm going to make profiles. This is if you want to run it on your device, I'll add an IOS app. Development profile First for the list of Matt Skill share AP I D, and I'll select my certificate and all of my devices and I'll just give it the name list of Matt Dev. Profile. Skill share could continue and l downloaded. And then I'll make another one for the intense. I'll choose the app i d. For the list of that intense. Choose my certificate, all of my devices and I'll name it list on Matt. Intense. Have profile skull share and I'll download those that as well. And if I double click those on my in my downloads full there, del, register into X code for you. In the next video, we'll add the intense target to our ex code project. 6. Creating the Intent Extension in Xcode: Let's add the intense target to our project, file new target and then choose the intense extension. You have to name it list. Oh, Matt, intense, and you'll see that it automatically matches the bundle identifier we used on the Apple Developer site. Make sure you pick Swift is your language and activate the schemes. If it offers to activate them, you'll see that it generated some files for us. There's a dummy, intense handler class that will implement later, and this P list, which will be configuring our intensive in future lessons. The intense, supported key here will be particularly important. Now let's go back to the project and our target and go to the Capabilities tab and open up act groups and turn that on and then choose the group you created in the Apple Developer site and then scroll down to Siri. And we need to turn on back ability as well. If you've done this correctly and entitlements file will be generated, which will have these keys in them, we need to do the same for the intense handler. So go to that target and turn on the APP group and choose the group and this already knows about Syria's, so you don't need to set that capability, but you'll see that it generated entitlements file here and next. We'll change our use of the documents directory to use the APP group sandbox instead. 7. Setting up the App Groups: to use the APP group sandbox on our AB, go to the list store dot swift class and paste. In this code. It's a function called Documents folder, which uses the group's sandbox. You'll have to change this group here to use your name, the one you used in the Apple Developer site and then wherever we normally used our application sandbox will change that to a call to the Documents folder We'll build. We can't run it yet because we haven't written are intense antler. But in the next video, we'll see how to do that. 8. Overview of Code to be Written: Okay, Now that we've set up an intent extension target, we can start adding handlers to it. The extension contains a handler for each intent it wants to handle. Each is a class that implements the protocol to find for the intent you register the intense you handle in the extensions info dot p list. The protocol for each intent defines three basic responsibilities that you can implement. Resolve, confirm and handle. Resolved is how you help Syria understand the parameters of the intent. Once you have successfully resolved the parameters, they will be gathered for your confirm implementation. You can decide if you can really handle this request. Finally, if you resolve the parameters and confirm that you can do the request handle is called to do the work requested. There are resolved methods for each parameter that you want to support. Syria tries to figure out their values from what the user said, but if some are missing, you can say that they were required and Syria will ask the user for them. For example, if you asked to add milk and list amat, Syria will ask which a list, but Syria might have a value for parameter and you still might not know exactly what the user means. In that case, you can ask for confirmation or present the user with a list. So if the user answered store to which list you could show all of the store lists, you can either return dot success if you know what a parameter means, dot needs value. If it's missing and you require it, doctors ambiguous ation to show a list of choices or dot confirmation required to just ask the user if you've understood them correctly, the confirmed method is called after all parameters are resolved. The default is to just say you could handle it so you could just not implement it. And that's fine for most cases, it's also okay to let the handle method figure it out. The final step is the handle method. This does the actual request that the user wants. It can tell Syria was successful, failed or that it needs the user to continue in the act. Now that we have the basics, we can make the class, configure it and implement the resolve, confirm and handle methods 9. Create Intent Handler for a New Task: before we start, there are two files we need from our app inside of the list of Matt Intense Target with store and list models. Don't swift. Select them both on the left and then check the target on the right hand side. Like so that's add a new class to our intent Handler. Target will call it list Amat. Intense handler. This will be a base class for intense and then let's add a class for actual intent called Add Items Intent handler in both of them. We need to import intense, so add that line into both and list of Matt Intense handler will be empty for now. We'll go back to add items intent handler and inherit from List Amat, Intense handler and i n at Tasks Intent handling, which is a protocol provided by Sirikit. Now we'll add a resolve method. We'll use the Target Task list, which will resolve the task list. We're trying to add tasks to and will also implement handle. In order to implement the resolve, we're gonna need a helper function to get the possible lists based on what the user said. Let's put that in the base class, get possible this will take a list name and return back an array of possible lists that match that name. We'll create an empty array to star in and will return that. And then between that, those two lines well, at this four loop, it goes through the lists in Load Lis and checks to see if any of them match what the user said, if it did, will return it. If not, we see if it contains the word or if they said the word all if it either contains the word they said, or if they said the word all, we'll keep a pending that to the list to the possible lists array. And if we don't end up finding exact match, that's what we'll return. We also need a method to help us find the right completion based on what they said and what possible lists return. I'll put an empty version of that here, and we'll fill it in later. We'll pass it. The possible lists the list same and the completion we needed to call Let's go back to add items in 10 handler. The first thing we need to do is figure out the title based on the task list. They mentioned, if they don't have one than we just complete to say that this is a required value and then return. Otherwise, we call our get possible lists method and call the completion Helper with the possible lists, the list they mentioned and the completion to call. So let's go Implement Die Now Here are the steps we need to convert the possible lists into an array of task list. It's just a simple type conversion. Then we need to look at the count of lists and respond accordingly. So to change the type of each of the elements in the list, we'll use a swift map, loops through each of the elements and will return. And I an task list with the title set to the string in the task lists array. The rest of the arguments tie on task lists are just the default because we're not using them, then well, switch on the possible list count. If there are zero elements. Impossible lists. Well, then we're just failing here, and we just say that we don't support this kind of phrase. If there's one first, we check to see if it's an exact match. If it is well, then were successful with that one. If it's not an exact match, then we'll just ask the user to confirm that we've gotten the right one. An example of this is if I said grocery, but the list was called Grocery store. Syria would just say, Do you mean grocery store? And a default when we have more than one possible list is to show a dis ambiguous ation, which is just the list of all the ones we found, and the user will pick one. We would get this if we said store and it would show grocery store and hardware store in the list. Now we can implement, Handle the steps are first, we load the lists and find the index of the one we want. Then we get that list. We add items to the list, save it and then just respond back with the added items toe load. The lists will call load lists that's from the list store that swift. Then, with this guard, we're going to first make sure that the intent has a target task list. Then we're going to use index method and this filter closure to find the one that matches Exactly. Then we're going to make sure that the intent has tasks in it by checking to see if it has a value and that that value has account greater than zero. If any of these things are not true, well just found. Now we can get the list from the list Saray using the index and next we will add items to the list. First, we create an added tests, empty array of tasks, and then we go through each of the items in the item names and add them to the list and add them also to the added tasks i n task array. We use the item as the title not completed as the status and the rest are just defaults. Now we save the lists using the list store method save. And then we just have to tell the user the items we added. So we create the i n add tasks, intent response with a code equal to success and then set the added tests. Property to the ad attacks of Ray were created and then we can call the completion in the next lesson will hook this up so that Siri knows to send add items. Intense tour class 10. Connecting the Handler: Okay. Now we need to register our intent. Handler, open up. Intent handler dot Swift and put this code into the handler method. This is called whenever Siri thinks it understands an intent, it'll send in the intent. Name I an ad test intent. And you just tell it what class is the one that it should use to handle it in 10. In our case, the add items intent handler. Then open up info dot playlist in the intent extension and in the intense, supported key at an item and just give it the value of I n add tasks intent. And that's all we need to do to register our intent. 11. App Parameters: Okay, we have a little app level configuration to dio. First goto the lists view controller scroll to the bottom of you did load. And we need to add in some code to ask for Siri permission. So we'll use i n preferences dot request Syria authorization and then we pass in this empty closure. This requires the intense module. So we'll go up and important that and now go over to your info populist in the APP itself. And whenever you ask for permission, you always have to tell why you're asking for their permission. So let's add a key for N s Syrian usage description and just say why we're asking for Siri that will be shown on the permissions dialogue. And now let's run Liston that make sure we pick the right target and you'll see that it will ask for a serie profession when we start and we'll say OK, and the next thing we need to dio it's at a key to give serious some alternate app. Names for Liston meant because list, um, it uses hyphens and its name. Syria actually has a lot of problems understanding when you're saying it. So we're going to teach Siri another way to refer to list in that we add a key called I n Alternative after names and we change that tone array. Then we add an item to that array and change that to a dictionary. And then we add a key to the dictionary called I n Alternative APP Name and woke. Give it the name list. Oh, Matt. Without haIf, it's and then we'll at another key i n alternative app, name, pronunciation hint and give it a guy for saying that list. Oh, Matt. 12. Testing Siri: let me show you how to test Sirikit. So first I'm going to just go to the grocery store list in list a mat and show you that we only have milk and eggs. Then we will choose the list. Oh mats, Intense target up here in X code and edit the scheme, and you'll see that in the run phase, there is a field for you to type in. The query you would like Siri to use when you run this intent and I'll put in list a mat, add bread to your grocery store list and we'll run the intent Target, which will start Siri Usar phrase and you see that it as bread to the list. Now go back to a list of Matt and into the grocery store, and we see bread is added. Great. Now show you a different phrase back to editing our scheme and change the phrase to just say the store list and we'll change it to cheese and crackers. This shows that we can add more than one item and that we can dis ambiguity among the various stores. Let's try that by running it, Siri will get the request to add to the store lists and asked which store you can choose grocery store and then it adds both items it used resolve in the first step and handle in the second, and then we can see that cheese and crackers are added to the correct list. 13. First Workbook: Okay, Now you're going to add an intent on your own. Try to do this exercise on your own. At first, you should probably download the pdf for these slides as a guide, if you need more help. There are hints at the end of the pdf, and if you want to see the completed project, check out the skill share Dash Workshop, Dash one, Dash Done Branch in Get You were going to add support for the search for items intent. A simple praise is in List a mat. Show me the grocery store list when you say that Syria will show you all the items in the grocery store. Now let's go through the steps to add an intent. First, we need to configure our intense extension target to say we handle this intent. We do that in the Info P list. The intent is named I n search for notebook items intent. Next, you need to create your intent handler. Class, call it search items intent handler and inherit from listo Matt. Intense handler, just like we did in the any other intense that will give us our helper functions. You also need to implement the I n search for notebook items intent handling protocol that will give you the resolve and handle methods that you need. You also need to update the main in 10 handler an intent handler dot swift. You need to add a new case to send this intent to our new class. Now we need to implement the resolve methods for the parameters we want to require. Resolve Item type is easy. We always want that to be a task list because we're always going to show the full list. Next. Implement resolve title. If there is no tile, you need to respond. Dot needs value. Look at add items in 10 handler and use. Get possible lists like it does make a helper function called Complete Resolve List. Name modeled after Complete resolve Task List Confirmed is very simple. You can leave it out and it will always succeed, which is fine for this. Finally, we need to implement handle, use the function load lists from the list store to get the lists, then find the 1st 1 that matches the title in the intent. Finally, create I end task objects for each item in the list. You could do this by mapping the list array into an i n Task one or with a simple for loop . Remember to update the intent handler. We need to add a new case in the switch statement that checks for when the requested intent is i n. Search for notebook items intense, and it needs to return an instance of the class search items and 10 handler finally test your work. To do that. Remember to update the phrase in the scheme for the intense target. Once you get it working, commit and push everything to your get hub fork of list on that and post a link to this skill share course. We'd love to take a look. I'm not going to go through the hints here, but if you download the pdf, you will find more guidance and some skeleton code to start from. If you want to see the final answers, look in the skill share Dash workshop, Dash one, dash done branch and get good luck 14. iOS 12 Custom Intents: up until 2018 you could only use the domains and intense that were included with Sirikit. But in Iowa's 12 Apple added custom intense to Sirikit. Now any activity the user does in your app can be donated to Syria as a shortcut. The short cut might be shown on the lock or search screens of Syria thinks it's relevant to the user, but it's always available in the short cuts at. Unfortunately, there is a big limitation. The parameters need to be baked into the intent, which means that the resulting intent will not have parameters at invocation time or a resolve. Step in your intent handler. Whenever you donate an intent with a different parameter, it's a separate shortcut to define a custom intent. You'll add a new type of file to your project. Ah Sirikit Custom Intense definition. This file is in P list XML format, but X code will show a custom editor to make it easier to work with the lists and notes. Domain is pretty extensive, so to use a custom intent will have to add a new feature. We'll add a copy list button to list on that and then make a custom intent for it. Then in a workshop, you'll an intent to reset a list by UN checking all of its items. 15. Second Project Overview: adding a custom intent is very similar to using a built in one. We configure the intent targets. Peel is just like a regular intense. Then we add the new Sirikit Intent definition file. The same one can hold all of your custom intense. Then we make the handler class and implement, confirm and handle. Remember custom Intense. Don't resolve parameters at invocation. Time to configure the intent. We just add an item to the intense, supported key. We'll call it copy list. Intent to help us make custom intense X code, added the Sirikit Intent Definition file. It's an XML peerless formatted file, but Explode gives us a custom editor to help us edit it. Add the custom intent definition file and add an intent to it. Then you define the parameters that will be baked into it. Remember these air provided the time you create the intent, not when it's invoked. In our example of a copy list, the user will not say something like copy the grocery store list. Instead, copy the grocery store list will be one intent and copy. The hardware store list will be another. The user will be able to provide any phrase they want for each and 10. But that phrase will not take parameters. I'll show you how to do this step by step. In the next few lessons, creating an intent definition will create a protocol for us to implement. We make a new intent handler class and implement the protocol by providing, confirm and handle implementations. Then we need to update the intent handler class to send those requests to the new class. Next, we'll do these steps together, and I'll provide guidance for you to add a custom intent on your own. 16. Implement Handler: custom intense are usually tied to features in your app. So since we're going to add a copy list intent, I've added a copy list feature to list a mat. If I go to this list morning routine, you'll see that I can copy if I slide. It has a couple of tasks, and when I copy the list, the new list has all the tests unchecked. This lets me start a new version of a list. The code for this is in the list of Map Repository. We won't go over it because it's standard IOS code, but I just want to show you the part where we're going to add Sirikit. The table view has a trailing swipe actions configuration for row at method, where we added a copy action actions configuration. That copy action function is here and inside of it. When the copy is actually invoked, you see that I've added a method here to donate the interaction. That method is right above. We're going to learn how to implement that the next lesson. But let's go ahead and add the custom intent. First we add a new file to the project. If you scroll down a little. It's over here. The Sirikit intent definitions file, and we have to add it to both target because both the AB and the intense target use it. Like I said, this is a simple P list file, but it has a custom editor will add a new intent which will call copy list. And then over here will say that it's a creation type intent, and we'll just give it a description. And the title and our intent takes a parameter A list. Remember, this parameter will be baked into the intense, not provided invocation. Time will also say that in our shortcut we have one version that'll be called copy and whatever the list ISS. I also want a quick look at the response, and we see that it can either fail or succeed, which is good enough for us right now. Now we'll add a file to the list of that intense target, and that will be just another class which will call copy list intent handler and just make sure that only the list of that intense target is checked and not the ab No, create that and we'll important tents. And here is our class. Like all of the other intent handlers we inherit from list of that intense handler and the protocol specific to the intent. When we created the copy list intent in the definitions file, it created a copy lis intent handling protocol for us to implement. And it has a handle function for us with a copy list intent type that it also generated for us. And let's go ahead and an implement handle. The steps would be will load the lists will find the one that we want to copy. That's the one that is mentioned in the intent copy and save that, say the lists. And then we have to respond back to Syria by calling the completion. So we we load the list with load list, as we've done before, and then here we're going to get the list name from the intent. Lower case it look it up in the lists array, and if we don't find it, we have toe complete with a failure. If we do, we'll copy and save the lists, and then we'll respond back with a copy list. Intent response object also generated for us by the copy list. Custom intent in the intent definition file and will respond with success and call the completion in the next lesson. We'll configure this the normal way, and we'll start to test it. 17. Update Extension Plist to Configure Handler: Now let's go configure the copy list intent. We go to the P list and we see that copy list. Intent is already in the intense supported key. That's because X code put it there for us when we added copy list to the custom intent definition file. If you're using an older version of X Code, you might not see this so put copy list intent under the intense, supported key. If it's not there now, we go to the intent handler and will copy this case and change the type that we're looking for to copy, list intent and return a copy list in 10. Handler Object. Now let's go over to lists view controller dot swift, and I'll show you how to donate the intent when the user does the copy action. If you remember, we had this empty function and copy action to donate the copy list. Interaction. The first thing we need to do is create an object of a copy list intent type. And then we said its list and suggested phrase to the list that the that the user is copying and a suggested phrase that mentions that list. This phrase is not one Siri will try to interpret instead. It is a suggestion, for if the user wants to add a phrase in the short cuts at then we created interaction. Object with this copy, listen direction and we donate it. If there's an error, will call a show method to show the user what's going on. In the next lesson, I'll show you how to use the settings up to get your donated interactions up on the search screen and how to invoke them. 18. Test New feature: Okay, now let's test our code. I've made a list called Morning Routine and you see, I've completed two of the items. I'll slide it to the left and copy, and now I've got a new list with the same items, but none of them are completed. Let's go to the settings that you'll see in the developer section near the bottom. There's a way to put Sirikit into debug mode. We'll display recent shortcuts in the search screen by switching the switch right here to on now we can go back to the home stream, go over to search tap into the search bar, and our intent shows up. Copy morning routine will click it, hit the create button, and that will run the same code and capitalist again. We go back to a list of that. We see that we have two copies, both with none of the items completed. There is no version of the shortcuts at in a simulator. But if you ran this code under device, you'd see that in the short cuts out, this intent would be available and you can use it in a new shortcut. From there, you would be able to assign any phrase you want to it 19. 2nd Workbook: Okay, Now you're going to add a custom intent on your own. Try to do this exercise on your own. At first, you should probably download the pdf for these slides as a guide. If you need more, help their hints at the end of a pdf. And if you want to see the completed project, check out the skill Share Desh Workshop, Dash two, Dash Done Branch and get Hub. To start the workshop, check out the skill share dash before Dash Workshop Dash to Branch, which already implements the reset button feature in listing that you just need to add the Sirikit parts. Here's an overview of what you need to dio Add the new intent to the custom in 10 definition file and then quickly check the configuration is done for you. Then write a new intent handler class and call it from an intent handler dot swift. Finally, at a call to donate the intent when the user taps the reset button and then test, let's go through the steps in detail. Open the intent definition file and add a new intent named Reset List. Follow the parameter and shortcuts set up that we used for copy. It should already be configured for you in info dot populist but check and make sure if it's not their ad. Recent list Intent under intense supported. Next, Make a new class to handle the intent. Call it reset list Intent handler and inherit from Listo Matin 10 handler and add the protocol Reset List Intent. Handling This protocol was generated for us based on the custom intent definition file. Finally, implement the handle method, find the list referred to in the intent and call reset list with it. Remember to update the Intent handler with a new case for reset list intent that returns an instance of this new class we just created. Finally go back to lists, view controller and donate the intent when the user taps the reset button. Now let's test your work. Go to a list and check some items, then go back to the list screen and resend it. Check that their unchecked, but recheck some of them again. Now we're going to test with Siri. Close the APP. Go to the search screen, tap into the search bar. When you're in test mode. Your intention already be there. Tap the button and Siri will reset the list again. Once you get it working, commit and push everything to your get hub. Forg of list on that and post a link to this skill share Course. I'm not going to go through the hints here, but if you download the pdf, you will find more guidance and skeleton code to start from. If you want to see the final answers, look at the skill share Dash Workshop, Dash two, Dash Done Branch in Get Hub. Good luck. 20. Conclusion: thank you for taking the introduction to Sirikit course. I hope you made it through the workshops and that you'll post your work so that others can learn from it. If you ran into any trouble, get in touch with me at lou franco dot com or on Twitter at Lou Franco hopes to hear from you soon.