Speech Recognition with Siri Kit (iOS10) | Sandra L | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Speech Recognition with Siri Kit (iOS10)

teacher avatar Sandra L, Front Development

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

11 Lessons (1h 19m)
    • 1. 1 INTRO

    • 2. 2 setUp

    • 3. 3 recordingView

    • 4. 4 speechFramework

    • 5. 5 askUserPermission

    • 6. 6 testIphone

    • 7. 7 saveBtnEnable

    • 8. 8 userDefaults

    • 9. 9 tableView

    • 10. 10 displayMessages

    • 11. 11 deleteMessages

  • --
  • 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 everything about the Siri kit speech recognition framework made available to developers since the last WWDC 2016.


Prerequisites & Requirements:

You will need access to a Mac computer running OS X 10.10 or later No prior programming experience is required. The course has been specially designed for beginners. The first chapters will walk you through the download and install process of the XCode 8 Application (to build iPhone Apps).

Meet Your Teacher

Teacher Profile Image

Sandra L

Front Development


My name is Sandy. I am a freelance Front End Engineer based out of Toronto, in Ontario, Canada.

- Check out the latest Learning Path Series :

React.js - Front End & Fullstack - React 16.8 + 

Intro to React: Getting Started - watch Intro to React: Learn the fundamentals - part 1 - watch Intro to React: Learn the fundamentals - part 2 - watch Build a Countdown Timer with React.js - watch Simple Todo List with using React & HTML5 Localstorage - watch React, Node.js - Build a Quote Generator with a Restful API - watch Build a Weather App with React, Bootstrap & HTML5 LocalStorage - watch Learn React Redux in less than 1 hour - watch Getting Started with React Router - watch Introduction the React Hooks - ... 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.

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. 1 INTRO: so new. But I was 10 and introduced at the last WWDC 16. The serious speech recognition FBI is now available to developers. So the goal now is to build a speech to text application. So we're gonna record audio messages with the phone microphone and use transcriptions to convert into text. So I'm going to start by showing you how to import and use the speech recognition Sirikit FBI. We're gonna ask for user permission. We're going to record messages and turn them into text. And finally, we're going to save the re transcribed text messages into lists using a table view and the class user defaults. 2. 2 setUp: So we're going to start with our speech to text applications, so it's gonna be a single view speech to text. Here you go. And I'm going to save these to the deck stop. And I am also providing with a sets for these projects, so we're going to see what's inside. So that's maybe those two pink fouls that we're gonna use to indicate. So when we are or nuts recording. So that's gonna be red when it's gonna be on the status of recording and Graham, when this is neutral. So we're not recording, so we're gonna add those two right now to our project. So let's So let's select the to then drug over like this and I'm gonna click, finish, you know, you go. So now we have the two a sets that we're gonna be able to use on the view controller that we're gonna use to record messages. All German citizen then messages Ojea messages and then convert them into text. And I am also providing with the text fell, and the 1st 1 that we're gonna use will be to ask for permission. So we're gonna ask the user for permissions to use the microphone in their device of the iPhone, so we can then proceed with recording. So we're gonna call this method, which is maybe a request authorization directly on the Firmer. So this is part of the framework to requests because this is a requirement with Apple to request permission from the user and when the user grants authorization. So we're gonna get to this case. So that's gonna be case. And it comes with different types of authorize is the one that we needs to get in or due to then set the authorizations to trousseau, meaning that we're gonna be able to then enable the button, which is gonna be used to record. And here we're gonna have in outlets that we're gonna name button recording. And you see that at first it is set as false. And then we're gonna enable this one with this property, which is gonna be either truthful. So depending on the authorization, if it was granting on up, and then we're going to be able to then start recording, So sorry, originally. So I have made this. I'll do two ruling French, so I'm just gonna change that soon I am listening so you'll get the one which is in English . I am listening. Start talking. Here you go. So you're going to get this message on the view saying that now you can start talking. So when this is ready to record and that's gonna be a text, you But that's gonna be another outlet on our in our projects, and we're gonna go through That's a little bit later. So now let's go back to the project and we're gonna go to the storyboard. So we're going to start building the interface. And for the first part of this determine, we're gonna take care of this part where we're gonna use so this view to record the older messages and then we're gonna have also table of you control it, and thats gonna be that's gonna end up being the intra point where we're gonna be able to steal the stuff messages recorded transcribed into text. So we're gonna get this one right now, so there's gonna be a table view controller a year ago. So for now, we're just gonna leave it as he's right here. Although we could start building and because we're gonna work also with one Buchananism, which is gonna be a navigation controller. So that's gonna allow us to navigate anyway back and forth between the two of you. So let's do that. So we're going to select this table view controller and make it the entry points to the application. So that selected. And then we're gonna check this one, which is gonna be easy initial view controller here ago. So this one moved to. So this one moved to here and next we're gonna keep this one selected. I'm gonna go here ator and that in and then navigation control. Here we go. So now we're gonna be able to navigate from the table view to the view controller, although there's no here connection, you see, So we're gonna need to create a sick wit. So I'm gonna go here and at the Burton items, so that's gonna be a control going to this navigation bar a year ago, and I'm going to select some one system item, which is gonna be ads. Yeah, because this is gonna mean so here. It's gonna mean that we want to add something to the least, So these tables you, we're gonna use it to display a list of messages so turned into text and here it's gonna be used to indicate that we want to add a new recording message. And here this is to indicate that we want to add a new recording message. So we're gonna sig weight from this from this new control Barberton item. I got a prison control and then drug over to the view controller, then release here ago and then I'm going to select show. So I'm gonna add unidentified air, and that's gonna be good, too recording. And now you see that we've got this navigation bar, so we're going to be able to navigate back and forth between the two. So that's good. So let's try that actually, a year ago. So we're gonna have this list. So for now, this is empty, and we're gonna click on this one year ago. So we go to that you, which is gonna be used to record our messages, and then we can go back. So, by the way, so we should add some title. So here I'm just not put list. Mr. Messages could be also to Jews. Whatever you have to do. List of messages within this. And here it's gonna be, uh let me see if I can actually add a title for this one title here present into. So we're going to need to add this one programmatically That's fine. So we're gonna go to the view controller. We can do that from the view did load that's gonna be self title. And then I'm gonna call, I'm gonna add the title, which is gonna be add recording recorded message now recording. Um, yeah, I'm not too sure how to call. It's OK, so that's 95. So let's run this, okay? The stuff messages. And then at recording, you can also reduce light because this corresponds actually to the message. So the title of this one Perego So you can also, you know, update this one. And this is something that we're going to see, actually, in another two journal, which is gonna be much more, which is gonna be longer and more complex, it is gonna be for a list of restaurants to display at least of nearby restaurants of based on your location. So we're gonna have an opportunity and occasions to see how it can customize change this message right here. So this title for the back button item. So for now, we're just gonna leave it as is. So that's gonna be for the ad recording. So next we're gonna take care off, creating this view, so we're gonna have any major view right here to display the microphones. So those ones, and then we're gonna have a text you right here. And also a button which is gonna be used to start recording the message. So see you then. 3. 3 recordingView: So now we wanted to care of these view right here. So we're gonna add first you y image view right here. And this one is gonna hold the image for the microphone. So we're gonna add some constraints. So we're just gonna put this win, So I'm just gonna put this one in the middle like this for now, we're gonna have also it takes to you like this. I'm just gonna remove you. See that you've got the stick. So this is the Remember some of going to remove it a year ago, and I'm gonna make this one as large as as White I see as wide as the image you. So we're gonna have concerns anyway, And finally, we're gonna have a button right here. Okay, so let's add some constraints. So first with the text you that's gonna be with height 23 from the top and then centred horizontally in container than the U Y image you. So that's gonna be with heights 19. So, compared to the ticks view and then center, that's well over isn't really finally the but me, But I'm gonna make weiter because we're going to be able to read start recording for step recording. So it's gonna be either one. So that's gonna be we're gonna swept the message of based on the mode. So the status of what you're doing. So if you are either recording or nuts So that said like this one and the constraints of that's maybe 50 from the, um it's you, then with heights and also always until e and continue here ago. Who has confirmed that with the late trains, and we're good for the out early out. Next, we're going to create some up. Let's so let me also change the title of these buttons that's gonna be start recording and I'm going to change the color as well defaults to these blues. I'm gonna change too. Um, Degree start recording here ago. So now I'm gonna create outlets. So we're gonna use the assistant editor interviewed, perhaps of the storyboard and the view controller side by side. So this one is gonna be we're gonna call this one that text to you. So the same way that we have, like in the texts fall. So that's gonna be more convenience for the wise. Remember to update the name so based on the outlet names that you have provided. So that's gonna be taken view of up type you. I text, you gonna click connect? Then I'm gonna have hear any match you and that's gonna be gonna call this one Microphone and Ridgeview That's an outlets also connect here. That's maybe, but on recording that's gonna be in outlets. We're gonna have also in action later. So, by the way, we're gonna create right away, right below here. So let's give this one selected and then drag over. And this time we're going to select action and this one I'm gonna call it Recording Britain Faction. And that's gonna be up type you y button the sender. A year ago, So you were gonna be able to have some actions of Phanom Ja's prints starting recording, and we're also gonna have some controls on this navigation birth. So that's some Give this one. We're going to keep this standard editor because then we're gonna need to create actions and also outlets for those controls. So let's go here to the library to the objects library Barberton item I'm gonna drug over. Yes, it looks like we've got a problem here. And it looks like I'm gonna need to add, actually a navigation items or for some reason, sometimes. So this is hidden. So let's go back here. We're gonna go to the main storyboards. Looks like I cannot add Barberton item yet. Okay, so what I'm gonna do, I'm gonna add a navigation item. And just to make things clear, I'm gonna added actually so using the document outline because you're going to see that this needs to be actually at the same level off the view here. So actually, at the same level, off the other outlets elements that we have here. So let me find the navigation item, this one. So I'm gonna add it, actually, right here first. Then we're going to see where it lands here ago. So our navigation item and you see that this time we've got the title visible for summers, and it wasn't showing, so we had to added programmatically so I don't know, this isn't exclude and I us things that sometimes you need to add an extra navigation item . So on top of the United Nations control, you see? Okay, so let's actually add a title here, and I'm going to remove it from the view control just to see if it works. Gonna put commenced for now, Back to storyboards here from here. But it puts at recording. We're gonna be sure that this time with guts, Honey, that it didn't change. Okay, Had recording. Okay. Okay, so I've named actually the navigation item, but here, it's actually something that you need to do from here. Okay, so let's run it. I just want to check that this is showing correctly. Okay, so let's go here at recording. So that's all good. Okay, so we're gonna continue gonna close this and here. So it's Jack. If we can actually add now the Barberton item. So let's look up for so that's took a Barberton item and then drag over. Like so Okay, looks fine. So we're gonna add a 2nd 1 on the left, and now we're gonna be able to then customize them. So we want for these ones of the one on the right, Right? Barbara, to the items. I want to make this one's like, save. And for the one on the left, I want this one to read. Cancel. So we're good on this part before the U. S. And next. I want to create outlets for those do. I'm gonna go back to the assistant editor and here in the Granite Creates, actually. So what I meant is that I'm gonna need one outlet. So that's gonna be for this one. Because ultimately what I want is to make this button available when we actually have a message recorded available. So that's gonna be at some point disabled, and then we're gonna make it enabled, and we're gonna make it enabled only when we've got objects, which is a recorded message. So I'm gonna create an outlet for this one specifically that's gonna be saved. But, um and Connect. And after that, then we're gonna create action. So I'm gonna give this one selected, and this one is gonna be saved, but in action. So I'm gonna select action from here and then select your Barberton item for the type. Let me close that to make it to have a large of you and then for cancel. I'm gonna do the same. Create an action. Now this one is gonna be Ken Soul Beckton Action, then action. And then type is gonna be you are Barberton item a year ago. And for now. So what we're gonna do is because we're using so we're not using, actually, So that's not gonna be just dismissed. We're using a navigation item here, So we're gonna use this function, which is gonna be self navigation controller and Klopp view controller in order to dismiss of the prisons you control. So that's gonna be animated truth. I'm going to do the same as well for cancel. The only difference is that this one, we expect an action which is gonna be too safe. Then you recorded message from just me playing something actually gonna copy from here. And that's gonna be message old your message, See? And that should be actually text message, because this is gonna be like, I'm going to write transcribe message statement. Okay, so let's run this so we can cancel, go back and then save as well and read a transcript message. Okay? And when we click on the button, starting recording. Okay, so that's good. So everything is connected properly and so last. I want to add the image here, so we're gonna go select it, and you're gonna have description on the rights to add one image. So I'm gonna get the 1st 1 which is like, the natural one. So that's gonna be the great one. So the red one is gonna be when you have started recording, and we're going to be able to display this one problematically when we have selected it, start recording. So I'm going to select this Siri Ping foul and also make the image fits. So make, um, and also used the specter fits in order to respect. So the inspector ratio and I'm going to use for the content mood aspect feet in order to keep the expected ratio for the hyphen away. So you see that for the width and height. So you see that now this is looking better, and we're gonna do some changes. So as we're here, So when we start to recording right here, so that's gonna be we're gonna do a few changes. So first of all, so we have the seek button here. I know my best with the start, not Britain recording, I meant so I'm going to change the title, so we're gonna be able to read like, stop recording. That's gonna be for the state normal. And also, we're gonna then update So this is microphone image view. And that's gonna be, um, the 40 inch and then you're right. Image 40 named. And this one is gonna become So we saw that it waas Siri read Pete. And so now let's try. So when we click on this button So we're gonna be able to see some changes this time that we have implemented programmatically. Okay, start recording. And here you go. Stop recording now, and this has become rent. So next we're going to see how do you actually work with Bo Jo? So with the class A V o J engine and also the framework speech in order to start recording and changing into text and also we're gonna need to ask for the user permission 4. 4 speechFramework: So for these parts, we're gonna actually use the text file that I have provided. So we're just gonna keep this one available at reach because we're gonna use this one and the first part just to see how we can work with the al Joe engine to begin with. Okay, so that's actually take it. So we're gonna have actually air, so I'm gonna show you. But just or maybe you could live it for after we're gonna copy, and then I'm gonna show you how to import the farm work speech. So we're gonna at this one, actually, right here. I'm going to remove these functions, delete and then save, so you're gonna have a few errors. So if you paste this one right now because we're gonna need to add So first, a few thing in court speech here ago. So that's maybe the framework speech, and we're gonna add a few variable here of different type. Let me regroup all the outlets. It's the first we're gonna. So first, we're gonna have a variable of type speech, Rick Organizer. So that's gonna be SPF speech. Recognize? Er about a name, just one speech. Recognize er like so which is one of your type S f as f speech? Recognize? Er light. So and we're gonna need to initialize this one with a local meaning that we're going to specify one identifier. So I'm gonna do that with local, like so and then, innit? And with one identify remaining that we're going to specify, actually one location. So if you're in the US in order to recognize so the English speech or friendship speech, let me show you one example which would be, like kind of different. That would be f r and cap F, or in order to allow the microphone the changing to recognize the French language. But for this example, we're just gonna do actually us. That's maybe English like so. So that's gonna be defined in order to detect the English language, and it's gonna be able to then record messages to recognize the speech, the English speech language and then re transcribed into text message. And then we're gonna have also one variable, which is gonna be up type speech algebra for African Nations request. In order to make a request, I'm gonna name this one recognition request. That's gonna be a type because of spit. There you go. Here, as of speech recognition, recognition requests, like someone that's maybe an optional. Then we're gonna have also a task. Now that's gonna be I'm gonna name this one recognition that Tusk, which is gonna be uptight as speech recognition test here ago. Finally, we're gonna have also the audio and Jean, and that's gonna be up tight. Let's initialize this one, actually, right here. And that's gonna be upto a V Oh, do engine like so? So you should see a few errors coming out, except that you were going to need to also like here. We're gonna need to actually confirm to one protocol. That's gonna be the firm ACC s F speech. Recognize the delegates here ago, and if you go back, you're going to see that. Now we have appears missing, except for this one. Let me see. Okay, so it looks like I'm using so the wrong quotes for some reason, So that's gonna be quotes like that. So just remove them actually. So I had removed them and retyped quotes. Looks like they were the wrong quotes, pretty coming from the text fouls, so just pay attention to that and we're good to go. Me too. So, for a self recrimination requests has no member append. So that's actually retyped this one for summers. And so it should go away. I'm going to confirm this one actually here, because this is supposed to be an optional, so I'm gonna wrap it at this level. And so also here we've got one air here. Savaglio type as a speech recognition request has no member depends. Let me go back. It looks like, actually have selected the wrong class. It is supposed to be as a speech audio buffer year ago. Recognition requests year ago. So let's correct that into, like, it needs to read SF speech, audio, buffer recognition request. And then we're good. Okay, so this is gonna be used to start the engine, and you're going to see that, actually to start recording. And then So that's review, actually, all of that. So we're gonna be able to start the recording, and then you're going to read in the text Few that we have added. I'm listening to start talking, and that's gonna be an indications to the user that they can start tucking recording their message so they can start to record. And so that's gonna be a visual indications to the user that they can start to talk and record their message. And after that, we're going to check if we actually have one tusk, which is already in progress. So if this is nearly so, we can If this is not new, sorry, we're gonna cancel it and then make it equal to kneel. So just to cancel the previous dusk and then we're going to start then an audio session. So these all of the settings in order to start the older session and then for the correct ignition requests here. So this is where we're going to initialize this one and after that. So when this is complete, we're going to be able to start with the transcription process right here. So in order to then assigned to the text, you instead of reading this right here, you're going to read what was recorded. And then Richard strived into texts right here and finally. So when this is not nail, So when you've got a result which is not Neil, we're going to be able to then assign so whichever value which was recorded by the audio engine. And then when this is finished, So we're going to stop the engine and then set everything back to kneel and allowed to record again. So the button with the button enabled with true and finally so there's a few set up as well , which is related to the audio settings, etcetera and what? So we're gonna actually starts. We're gonna actually, So call all of this from the start recording button, and that's going to be right here and what we're gonna do. So we're gonna check a first. The audio engine is already running because if this is already running, so we're gonna use actually this party which is available, which is a bull. So if this is already running, what we want is to actually stop the engine, and this is only if this is else we're going to start recording. So if this is audio, so let's take care of the part when we actually start recording right here. So we're gonna actually start recording, and also what we're gonna see is we're going to change the image from great to read, and also we're gonna be able to read Stop recording. So that's gonna be the option if we are. So if the recording isn't progress, so that Miriam of that. So that was just for the first part of the demo. And if this is already running, so if there is already a recording in progressive, that should be the option. First, the audio engine is gonna be said to stop, and we're going to request also. So with the recognition request to end the audio and all social for the rest of the set up , so that's gonna be actually with the U. Y. Which is gonna be to go back to Grey for the microphone image, and we're gonna be able to read again, start recording. And we should also add some color text car. No, that's actually teens called her you I corner. So I think it waas it's gonna go back to Grey. It was great. And then for here, it's gonna be ready. Okay, so let's try that now. Okay, so let's go there. Let's try something. Looks like we've got so here the identifier and you could actually checks the supported local, so you can see if this is actually the one that you want to use. So I've used this one before. So for French, French language and for the U. S. That see, if I haven't mistakes and looks like I have mystic because nobody is supposed to be a dash and I put it on the score. Let me just revise its so that shoot English here ago, English, us. So I'm going to change that to this instead of underscore. So that's maybe and iPhone you're going to start recording. It's gonna jump to read, and then you've got the option suit. Then you can read. I'm listening. Start talking. So we're just gonna align this one in the center, and then you can go to stop recording, so it looks like the color hasn't changed. Um, you team color for when you are actually recording, I'm not sure. Starting recording. And then right, OK, so I'll check that leader. So we're gonna do a few changes for D u I. So this year. So the text you said we want this one to be aligned in the center here ago. Let's go back to the view controller, okay? And of course, right now, So we're not actually. So using any microphone. So with this application. So we're gonna need to actually ask for the user permission in order to actually be able to use the microphone than record messages and then re transcribed them into text so we can then save them to have, at least so we're gonna do that. Next, We're gonna ask for the user permission. 5. 5 askUserPermission: So now we're gonna get to the part where we're gonna actually be able to do some recording . But for that we're gonna need to first be granted the permission from the user. So I am providing. So in order to make your life easier, with some code already written and that's gonna be here. So we're gonna go through this of the baby from here to here, so that's going to ask permission. Commence E close it again. I think I'm gonna put this one so right before here, because this is supposed to be, like the first thing that you would actually do before you can actually start recording. So here is gonna be asking for the user permission. And when it's gonna Jews that it's gonna allow to make the button recording enable because because at first it's gonna be actually disabled. So that's actually put one. So we're gonna put, um, this actually invited load, so we're not gonna be able to actually record anything until permission was granted by the user. There you go. So that's not gonna be enough to put this ask permission. And also, I'm going to call this function right here. because, based on the permission granted, then we're gonna be able to first enable the button recording, but also to then proceed with the recording off a role. Okay, so here again, See? Denied, restricted, not determine. So that means that it wasn't asked yet restricted. So it wasn't. It was, like, restricted in some points in some ways, so it was restricted in some way. So here it was, like, just denied. And if off the rice with this is gonna give us the green light and if all the rise, that's gonna be the green light, so the button is gonna be enabled, and then we're gonna be able to go ahead to record. So that is a requirement from Apple. So we're gonna need to also update the info policed for that right here. We've got the info policed and we're gonna use, So we're gonna add some parameters to this, leased this property leased interview to then ask for the user permission. So you know that this is gonna be like the window a dialogue opening. So the So you know that this is gonna be like your window dialogue happening on your absolute requesting for the user permission before. So we're gonna allow or not a now. So then the APP is gonna be able to use the microphone. So we're gonna add one by clicking on the plus. So the 1st 1 is gonna be and us speech. So I think you can actually have them come out by just typing privacy. And we're just gonna browse here. Microphone, we've got one here. Microphone. Use a description, and we're gonna simply type. So you know that you can, just in order to get the name of your app, just copy that and then paste. And we're just going to write something like needs to use. You're a microphone, and you're gonna see this message. So at the start of the application, you're going to see and read a message like that popping up, and then you're gonna click either allow or don't without. I'm going to copy that because we're going to add another one, and this one is gonna be used to allow to use the speech, recognize er recognition, and this one is gonna be I'm just gonna take everything in. So that's maybe s speech recognition use age description a year ago and I'm gonna piece and this I'm using the exact same message, actually for both and here ago, so I couldn't find this one. But you could actually find the same privacy speech regarding using usage if it's easier, and this firm, it is a probably least from it. But you can also have, as source code open as source code formats. So if it's so, if it's more simple for you, you can also simply copy and paste. So we're gonna have to keep out the apparent that's gonna corresponds to the two last entries to that info policed. So first, the microphone use age description and it texts one string object as a value and then speech recognition usage description that takes another string object as a value their ago . So we're going to save these and then go back and we're ready to go for a test. So this time you're going to see a window popping up, asking us for permission as a user, and actually we're gonna go there plus year ago. So speech to text. I would like to access speech recognition so speech data from this up will be sent to Apple to process your request. This will also help Apple improve its speech recognition technology. And finally, so our message that is speech to text needs to use your microphone. So here ago. So that corresponds to have a message right here. Let me open it as a probably, least again here ago. So now I'm gonna click. OK, then I'm going to be able to then start recording, okay? I'm listening. Start talking. So interviewed to actually make one, um, demo. We're gonna need directly to use a real device and iPhone device in order to make a demonstration, because this is not gonna be recording anything. Have you had this senior leader? So we're gonna do that. Next, We're gonna use a real device in order to make one demo. 6. 6 testIphone: Okay, so now we're going to make one demonstration. But that's not gonna be from the simulator. So that's gonna be using one rial device. So you're gonna find So once you have connected to your iPhone using a USB cable, you're gonna find your device with your name at the very top. Then you're going to select this one and then run again. And here goes, and now we're gonna be able to preview our applications. Were using a real device on my iPhone. So I'm gonna click, OK, in order to grants permission, Do this application to use my microphone to these application to use my microphone, and then I'm gonna click, start recording care, Go. I'm gonna have another one to confirm, okay? And I should be able to record. So whatever I say, no. And the other big mistake that I've made, I'm sorry. I'm just realizing. So I have actually inverted the truth. This is English, excellent. And us. So that can never work if it can, actually, if it cannot actually recognize which language you're speaking. So that's changed that to English iPhone us Right here. So you actually see the list in your consult. So I've just updated this one. So let's go for a run again. A test run Start recording. Just I'm going to stop and then start again because, well, it kept, I'm gonna change. So when we're gonna end the old, you were gonna have the option structure to go back to, um I'm listening. Start recording. So we're gonna have another option. So when you end the oh Joe to chance the message to something neutral by tomatoes Erica and then the other options will be to then save this message in order to attitude is right here in at least of table views, getting table views and keep a list of messages that have been recorded so much like a shopping list, for example. So next we're going to see how check Shuli, record our messages and keep that as a list of messages they were going to be able to display in a table of you. But before electoral, so update the y N order to change the message. So when you as soon as you click on stuff recordings, I want to change actually the message which is displayed so we're gonna do that fixed and then move on 7. 7 saveBtnEnable: Okay, So I want to do a quick fix, and I'm gonna create and you function, actually. So that's gonna be I'm gonna call this one. So we've got start to recording, and I'm gonna call this one and recording right here on this one. Basically, that's gonna be mostly to update you. Why? So So, first of all, we're gonna check it. The text view is actually empty. So if this is empty or a for ken, read text you text is the cool to this message right here. I'm listening. Start talking right here. So, basically what we're gonna do, we gonna allow So the save button to be enabled to begin with else it's gonna be disabled. No. It's gonna be disabled here. First it's gonna be disabled, is enabled. That's gonna be false. And then else it's gonna be enabled. So if we actually have a message available in the text, you so as a result of recording, then it's been re transcribed, you know? So as soon as there is an object available in that text, few. So if this is not empty, we're gonna then be able to enable the same button and then click on it in order to then save it as a message I did to our least and displayed and display it in the table you and whatever we have recorded And rich inscribed hever transcribed into text message. So that's maybe the last message that we're gonna be able to read in the text you before we can actually save its. And that's gonna be actually the next step. So what we're gonna do is so let's go. Actually, in the view controller. So just in the Minster report. Sorry. Right. Here we go right here. So you're gonna have a text message. So that's gonna be the re transcription of your apology recording. And then you're gonna be able to click save when it's good to go. So let's try. Actually, that's in the simulator. So at first, Kara Clarke looks like it looks like this is actually enable, so that's not good. Okay, so let's go back. We're see when I might miss, I'm going to see what am I missing? I'm gonna see what I'm missing here. And so instead of just putting this, um, button enable, I think it was in and one of my missing is actually to put also deceived button. I totally forgot this parts save that time. So we're going any tragedy? Disable. It's on video note. Close. Okay, So otherwise we're missing. So the whole point. So we're gonna have so the button recording, which is gonna be enabled false and also the save button, which is gonna be enabled at first false and on Lee enabled when we actually have an object string available in the text. You after recording the message. So let's try that this time we're gonna go here, and now this is disabled, you see, And we're gonna be able directly test that this is working just fine. So by making attests that what I'm gonna do actually is go straight to the other lesson, which is gonna be to work with user defaults. So that's a class that we're gonna use in order to save user data. So that's gonna be this is used originally to save preferences to an application. So this is for basic iPhone applications, and we're gonna use that to save, so the data that we're going to save as it takes messages after recording them. So we're gonna use user defaults in order to save these as to do so. Let's do that next and also test with the same button. 8. 8 userDefaults: Okay, So for abuse them, I'm going to start by creating one variable, which is gonna be a type. So right here. So that's gonna be default. I'm gonna call this one defaults, and that's going to type user user defaults and then standard, like so And then we're gonna be able to use that in order to excess eso the data. So we're gonna be able to save all the messages that we're gonna record infants and then transcribed into text to the memory of the phone off the application. And so we're gonna do that at this level. So that's gonna be save save, but in action. Right here. So with these defaults, first of all, I'm gonna get so the text missing, which has Bean Richards rodent then displayed in the text. You So that's gonna be taken to you text. And then we're gonna have So these defaults, actually, I'd like this to be defaults. Okay. Looks like should be defaults within s year ago. And then we're gonna set a value, actually. So this is this works much like Cordy knife. You have you escorted us, so we're gonna be able to then set of value, which is gonna corresponds to a key. So that's gonna be we're gonna use, actually. So whichever texts we have registered to that text you so displayed in that text, you and that's gonna be for the key to deuce a year ago that's gonna be to do is within this. Okay, so that's all their students. So this syntax is super simple. And for now, as a tests were just gonna print, so did you saved. And that's gonna be true to actually, I'm gonna pass using the interpolation, so that's gonna be to do so we're gonna test this for now. And of course, we're going to do that with one device, So I'm gonna need to connect my iPhone to my laptop. So I have connected my iPhone to my laptops, and I'm gonna test using my iPhone. So you're gonna get this one by going all the way to the top. There goes the first. I'm just gonna make a test and you're going to see in printing. So first of all, we're gonna be able to see So as soon as we're done recording our message So the save button, which is gonna change to enabled buying tomatoes. So I'm gonna stop, and it looks like it didn't work because maybe I've missed something somewhere and recording. And remember, when we have set up this function right here, So we're not actually calling it ever. So I'm gonna need to call this function of from so here when we actually stop the engine and everything. So we're gonna go back to start recording, But also, we're gonna need to then call this function, which is to end recording Keira. Go on, keep track of what we're doing. So we can actually allows with this save button to be enable. So let's try that again. So starts buying tomatoes stuff, and now I can save, and I'm gonna be able to read to do saved. So it's optional. So I should have actually just confirm unwrap this one with the bank, but that spot so as not gets we know that this is working. So now we're good for the next part, which is gonna be, too, because we have saved actually to the defaults. So now we're gonna be able to move on to the tables, you part. So we've got this least table view, which is available in the storyboard. So we're gonna need to create a new class in order to control this one, Problematically. And actually so first of all, configure the appearance of that table view, So that's gonna be very straightforward using the data source methods. And then we're gonna creates a collection which is gonna be just for the two Duce. So the message is that we have recorded and were transcribed. Actually, I'd like to change the name to messages, so I'm gonna change that to messages. You so entered it to clean your memory as we here, because I'm gonna need to update a few, so I'm gonna need to update. So whatever I have saved to my defaults, because now this is recorded. So I'm just gonna reset here. I'm gonna jury set content and settings here ago reset. So that's going to reset the simulator and he raise any data that was saved in the simulator. So there were good to go to start fresh. We're gonna change the name to messages here, and then we're gonna move on to the table 9. 9 tableView: Okay, so now we're gonna take care off the table of you. We said, let's go back to the story board. So already have this one set up here. So what's left to do is to create a new class cocoa touch class, and this one is gonna be off type you white table view controller. You I table view. So make sure that you've got this as a subclass of you white table view controller, and I'm gonna call this one, so either way, that's gonna be your choice. You make all its messages table you control or to Jews, table view control because this is meant to be used like as the least that you can update and that you can use as a least off to do that you can manage and for which you can use and that you're gonna be able to, uh, dates by using the microphone by recording messages. So click next creates Perego. So you've got all these boilerplate. It's generating its interning from the white table view controller. And the great thing is that it's already confirming to the u I table. You did a source and delegates, So the data source, which allows you to control the appearance off your table of you. So we may need a few things here, so we're just gonna leave it for now. You can, just in order to make them available. So based on your needs, you can just remove the command signs we're just gonna leave you to now and then we're gonna be able to indicate so the number of sections so that's gonna be one. Then we're gonna configure also with the above rose. And I'm gonna write 10 and also configure this cell Peru. So we're gonna need one identifier for every prototype cell. So I'm gonna put I'm gonna call this one message cell, and it must match whatever you put in the storyboard like So So we're going to select the part of type cell, go to the rights, and here you're gonna put the ed into higher. So the two must much that's gonna be message cell. We almost don't so energy to connect the two. So we're gonna need to also go to the identity inspectors to make sure that you select this one here. We're gonna go to Identity Inspector and here we're gonna then assign. So the new class that we have created So we're going to be able to then control the stable , You in the story board, programmatically So we're gonna make a test quick. But first, let's go back to actually configure this cell so we can read something in our table. You. So that's just gonna be something static that's gonna be text label. So that's gonna be the label than text. I'm just gonna write message, and then I'm gonna use thes index path, So that's gonna be the interpretations in text. I'm going to use these index path here for our meter That allows you to access the room, the Rue Index, our position of one elements in the least. And I'm gonna add one, introduce you about this one to start at one because it works just like a loop. So that's going to start at zero. And it's gonna go through every object that you have any collections because very often you can actually pull the data from one collection, and in that case, it's gonna be an array of messages that we gotta create. So here it that's up. I'm gonna created right now it's gonna be of our messages, and there's gonna be a collection of string objects. So you know that we're gonna be able to save actually texts, messages. So string objects. So we're gonna collect that from the defaults. So after saving them, recording them and then saving them to the defaults off the applications of the phone, we're gonna then collect them. So we're going to do a quick query using the defaults. The class user defaults began in order to then assigned to this messages and finally allow these later source methods to look through every object that you have in that collection in order to display them. So that's from that. Simply now, we're just gonna have so at least of text like so, like we're gonna be able to read. So this is just to check that so that this is connected properly here ago. So you've got this list of generate texts which is displaying so ultimately what we want is to actually display the messages that we have recorded. So we're going to do that. So we're going to do another test using so the iPhone and the microphone let's do that First of all we know that whatever we save, it's gonna be saved to the defaults. It's not gonna be able really gonna be able to display to right away. But after doing that, we're gonna go back to the table, you controller, in order to do a query using the class use of defaults again energy to then display. So the collection of messages that we've got available using this key messages So let's try that place. So I have to use my phone to actually be able to use the microphones of the physical microphone is not working anyway with this human leader. Okay, so let's go to the microphone views start recording by tomatoes. But I'm going to start again because you see that I was starting to speak to stop start recording again. It's on my bed by tomatoes. There you go. So that was saved. So what we're gonna do next is we're gonna do a query using the class user defaults class. So what we're gonna do, that's gonna be pretty simple. So, first of all, so what I'd like is to make this, um, variable public right here by allowing so by just putting this one outside of the class like so. So I'm gonna make this one public. So by using this keyword public, and then I'm gonna go back to messages tables, you controller. Then what we're gonna do is going so at this level. So we're gonna have, like, Kim the function. You can put that right here. Good uproots. I'm gonna call this one cap messages. So from this one is gonna be like a completion actually going to return an object, which is gonna be actually, um, messages of type in history. It's gonna be void for the objects returned. And what we're gonna do is here. I'm gonna have, like, local variable to the baby in your area. It's gonna be a type every detective string objects only. So that's why we turn our species finds at this level. So when we initialize it and then what we're gonna do first is actually checking if we have items available for the defaults because you may not have anything saved to the default. So they say that you start the application for the first time without having recorded and in messages yet. So you're going to need to check if you actually have objects available existing for the defaults. Otherwise, there may have some issues with the execution of the program, so that may crush. So here. What we're doing is doing a chick when that's gonna be with a flood item defaults. Let me see here. So that is completion. Okay. I have wanted stripped Artist is here, and so now I can check. So by doing defaults, objects for tea. So the key Waas Maxygen. So this is the way that we set it up. So we have defined So any objects that were saving So this is gonna be under the scheme messages. And that's maybe as hey stream, you're gonna return that. And then So if we haven't eat items available, some just put quite a bit. Actually, with this, I'm gonna send a sign to Yuri the pens and then item. So if this is if you actually have any object available so in the default, so that's gonna be assigned to item going to score here. So that's the new swift three syntax. So if we've got so if we've got any items available in that array, so I'm gonna be able to I mean for that key messages. Then we're gonna assigned to this and then appendage Junior Earth. And finally, we're going to return this as a completion, have you a raise, and I'm gonna call these functions right here, form from beauty load. So that's what gives messages going to return something. Put this one nice messages and then assigned this to my global every he's gonna be full two messages. It's drink. Okay, So next what we're gonna do is using, actually, so the data source methods. But it's just confirm a few things here. Well, it's not what I want. Actually, no messages message because it's gonna be self messages, which is in a rain messages. You, Marie. Maybe it's confused with just gonna call this one message. It's supposed to be Oh, my bed's okay as Minnery. And that's array. Of course, this is what we're best in here. So I was just focusing on a mystery. So now this is good. Okay, So although I could have actually confirmed, I think it's fine. Researchers posits train too many things. So that's what the message So maybe we can go back to messages has strange because this is string objects in and every so there was no other warning. So Pinterest continue. So here, So instead of just adding so an arbitrary number. So we're gonna record to the count of messages that we have in that object in that earlier that collection and the way it works is that it's gonna display as many rose as we have objects in that collection and also then display. So the text, the correspondence too bad collections which ever string object saved with her, then access to it by using the index interview using somebody in this room which visit into jerk, you see, And we're gonna check normally we should be able track to displace or the last message that we have recorded. That was by tomatoes. That's when this so by tomatoes here ago. That's good. This is working just fine. So let's try another one, make appointments with dentists. Okay, stop save. And the other thing that we're going to do something we forgot is drinking. Refresh the data off the table because now So we've got something registered, although it cannot really reloaded. So I'm gonna do that right here, which is gonna be self table abuse. You do that almost all the time when you work with table view, which is to return with data. Otherwise it's not gonna refresh because we're passing to another. You were going to enough of you and it's not like it's is gonna be this gonna be activates activating this function again a year ago. Make appointment with dentist. Although it looks like it's weird because normally you have to objects and that defaults on it. Maybe like this is overriding the lusts entry. So let's try again by tomatoes, okay. And the other thing, that's good, because we're making so different tests instead of calling this one. So from Judy note, I'm gonna also update. So because that's gonna be the lifecycle functions here that we're gonna need to work, we want to also a date, actually. So calling this function again to reload the date out. So in order to see what we have available in that collection of defaults, we're gonna actually call that from this function, which is viewed it appear, meaning that, as opposed to view did load that corresponds to the start of the first start of the application. We're gonna call this function so each time, but the new each time that the view off the tables, you controller appears. And we're gonna need to also call Super from the Super Class, the parent glasses that's going fugitive here, and that's gonna be animated. So let's move that to actually, you did appear Paul effects Because each time, but we're going to see these Steve over your peers. It's gonna call this functions to check if there's any new messages recorded than assigned to that collection, then refresh the data and so forth. Let's try again. Okay, Looks like I have my last messages by tomatoes, but it keeps overriding, so whatever I have recorded before, so let's see Meg, dentist appointment Stop, See and hear ago So you can see that this is refreshing. This is updating the although this is not taking into your council which ever recording I've made before. So we're gonna need to actually proceed differently, which is directly create honoree for the defaults in order to have a collection off defaults safe. So we're gonna do that next. So we're gonna do a few fixes as to how we proceed. So as soon as we saved the messages 10. 10 displayMessages: Okay, So now so what we're gonna do So we're gonna actually update So the way that we sleep So this data. So here I'm going to do it differently and choose to actually save a collection as opposed to just one string, because otherwise it's gonna keep of a writing. So whatever we have saved before, So here what we want is to save Oz gonna raise, So that's gonna be several. So I'm gonna keep this one as let to do here, and I'm gonna have I'm gonna create here in a range. So that's maybe barca rain, And that's gonna be, um, that's in generate of string. And then we're gonna depends. Then you to do to a list collection. That's maybe to do finally, we're gonna need to set this as a default. And this time it's not gonna be that you do, only we're gonna save, be hurry. So we're going to save a collection. So there is one thing, actually that we're gonna do right away, because there was something that's it's not that is not gonna work if we proceed that way. So we're gonna need to actually check if we already have a collection, you know, due to then get this collection and then actuate so which have a collection we have available. So in the defaults, we're gonna then first make a query to get that collection and then add to it. Basically, I'm going to do just like, here in the messages table view controller here. I'm going to do an optional chaining to check if actually have objects available for the defaults for that key and then assigns so which ever defaults car available, then assigned to that hurry. And next to that, adding the new messages that I have just recorded So that's gonna be one after another. Let's go back here. So I'm gonna join optional chaining. So there's gonna be first if let messages like defaults objects. Okay, so that's gonna be messages. So that's gonna be a comm person and then an assignment at the same time. Uh, here, What we're gonna do is first, so create. So we're gonna get So Actually, actually, I'm gonna put this one outside because we're always gonna have, like, this saber connection is always gonna be actually working be enabled. So once we have an object for that text you. So this one is gonna be outside because he's gonna be here waiting to be assigned. Do that array to the defaults. So then when we have so this new collection here, So then we're gonna assigned to every first here. So whichever collection is available already and the default to the enemy messages as collection upstream, so that's gonna be the first step, and then we're gonna sign. So then you to do here. So that's gonna be the last message recorded. It gets it gets added to that message is already available in the defaults. And finally, we're going to set the defaults using that hurry using the same key, then which is gonna be messages. And if this is not the case, if you actually don't have any messages yet, so which could be the case? So if you start the for the first time, so obviously you're not gonna have any messages recorded and hence no defaults yet, so we're going to do the same thing. So we're gonna initialize and you were right than a pencil which ever message first message you have recorded. So that's gonna be to do and finally said the defaults, and that's gonna be here the same. So we're going to set the defaults for the array, the collection, using the key messages. So that's always gonna be the same process. Except that here, what we want to do is to check if you actually have messages defaults saved first, then make it equal. So make the race of the new one initialized here, equal to the one saved. Then add the new messages recorded after that. That's confirm a few things year ago. So you see that this is gonna change up to you the way that we're gonna be able to control . So the execution of our application here, we're gonna have our list of messages recorded. So let's try that. We're gonna do a test the here, go get a test with the iPhone. So down the iPhone again. So for now, we haven't saved anything so using so because we haven't used this logic here. So this time going to record something you by tomatoes, Stop that. I'm gonna say when you go to see that, it's gonna be added. So looks like we've got an air here. I'm going to see what it is, could not cast value of type. And this turning to Ennis array. Okay, looks like I've made a mistake along the way. And the mistake that I've made here is actually And the mistake that we've made here is that actually, it's pretty visible when you look at the console. So here you see that this is messages as any as any object, because we haven't specified. So at the time when we have set up so the defaults object and so forth here, we need to specify that this is gonna be, as with a question mark and I strain because otherwise the defaults off original eyes doesn't know the type natively off the object that we save. So we're going to specify at this level. So let me do it clean otherwise is confusing. So here we're gonna add that we want to get the object here as a string as touring objects saved in a collection. So we need to specify this at this level, otherwise it's not happy. So let me see for this one as well, and in that case, you actually don't need to specify it here because it knows that this is generate up strings, okay. And obviously here we're using the same data type, which is important. Otherwise it's gonna be, um, crushing against. So let's try that again. So first it's gonna allow us to save Let's go back, buy bananas. It's the they're ago. So save on the reason it's not showing anything is because now we're gonna need to then update the way that we collect fetch. So the information from that defaults. So here what we're doing is to first get the items as just string. Although what we want is to get this time a collection of strings and then looked through every object you know to do them a pen to that Nouri. And what we want to do here is to get a collection office string objects than loop through each object to upend, do that on your right and then pass it right here and then assigned to messages so it can display all the messages. So we're gonna need to update that for the table of you, so it can actually read the data properly. So let's make some corrections. That's when you actually items, and we're going to change that to be on a rate up strings, and then we're gonna look through every object. So that's gonna before item in items because we're gonna get, like, here, several objects in that collection, and then we're gonna then pacified him, and then we're gonna upend the items, and that's gonna be fun. And that should be fine. So that's just that's the Onley change that we're going to need to make. And we should actually specify at this level that this is here collection with string, just to stay in line with years of the data type just to stay in line with here. So here the data type off the default. So that's better. Let's try that again. So I'm gonna need true run that's using my phone here ago. Oh, let's try another Mech dentist appointment and here ago. So this time this is recording and, you know, saving. So as a collection, and then we're able to display them. So one after another as a realist, call Jim stuff and and save. And here go, and what we're gonna do next is to allow to deal it. So once we're done with one message, I mean, once you've done the task, which is described here, so they're going to be able to do it to deal it off those. So let's see that next. That's gonna people the delegate methods available with the tables, you controller. 11. 11 deleteMessages: so here we have. So the data source methods and we want to actually get one delegate method, which is gonna be right here, And that's already provided because we're using one class subclass off white table view controller and this class and these methods that's going to allow us to delete from the table. So with one animation so we're gonna delete from the collection, but also from the memory off the phone. So here. So that's already set it up what we're gonna need to do next. So this means that this is enabled this feature. What we're gonna do next is to allow to off course removed from that least which is messages. And then that's gonna be pretty much that's gonna be pretty straightforward. So that's gonna be roof at and for the index. So the position index, we're going to simply use index path, and it's gonna be just like this method here, which is used to look through every object that you have in the collection. And this is displayed using the index position for every index position. We're gonna get one object for one room, one cell and here, so that's gonna be so which ever sell that we target that we select. That's gonna be with the swipe gesture. You can see that you're gonna be able to swipe on one room to get the deal. It's option controller, then click on it to delete the rows of the object that you're targeting off the least and you're gonna have and you're gonna have this nice fade animation. So that's try that year ago. So let me swipe. So I'm gonna swipe this one the last one, and then I'm going to be able to click Do it. But let's see what happens when I run the APP again. So you may already know what's going on because it's true that we have seen this one. We have deleted this one's from the least, but we haven't deleted it from the memory of the phones. So we're gonna need to also update the default. So let's do that as well. So basically what we're gonna do is which ever new update that we have for the list of messages that you know here this collection. So once you have removed so from the least by using this function, which is removed by using this built in function, which is removed at index Bath Robe. Then we're gonna use again the defaults and then sets. That's gonna be pretty straightforward. So what we're doing here is to reset the exact same thing using so the last update of messages. So we're using. So So we're using the last state content of messages to set as messages for the key messages. So what we're doing here is simply dating for the same key messages. So what we're doing here is updating for the key messages with that collection off messages minus. So the message is that the message that we have last dilated, You see what I mean? So we're gonna do that again, Run. We're going to remove from the least and what we're gonna do spurs removed from the least is Then we're gonna have these faint animation. Finally, we're going to save these new collection minus the last that we are dealing for the key messages. Let's do that. And I'm going to start again to see if it worked properly. And normally I shouldn't be able to read against this last one which was called Jean here ago with this time. So that was in sync with the collection that you have saved as a default in your food bottles with you. I Let's try another thing, Cole Henry save a year ago. So I have my dentist appointment, which is now complete, going to remove. And here ago. So now you've got the same least two minus the one that you have just visited because we have updated our defaults with this line.