Apple Watch App Development for Beginners In Swift ✅ | Afraz Siddiqui | Skillshare

Playback Speed

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

Apple Watch App Development for Beginners In Swift ✅

teacher avatar Afraz Siddiqui, Engineer | Designer | Teacher

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

8 Lessons (55m)
    • 1. 1. Getting Started With Apple Watch App Development

    • 2. 2. Outlets & Actions In Apple Watch App Development

    • 3. 3. Create Tables In Apple Watch App Development

    • 4. 4. Allow Text Input In Apple Watch App Development

    • 5. 5. Create Multiple Screens In Apple Watch App Development

    • 6. 6. Saving Data In Apple Watch App Development

    • 7. 7. Images In Apple Watch App Development

    • 8. 8. Wrapping Up Apple Watch App Development

  • --
  • 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 build awesome Apple Watch Apps for absolute beginners. We will be using the Swift programming language and explaining everything along the way. Some topics we will cover include Buttons, Labels, Functions, Images, Screens, Table, Text Input, and Outlets. Come join me and lets make some awesome apps together!

Meet Your Teacher

Teacher Profile Image

Afraz Siddiqui

Engineer | Designer | Teacher


Hi there, I'm Afraz!

I've been writing code, building awesome software, and designing creative projects for over 12 years. If you are interested in

iPhone or Android App Development Website Development / Design Cloud Computing Photoshop / Adobe Suite Tech In General, Just Improving Yourself

you are certainly in the right place!

I have taught hundreds of thousands of people just like you how to succeed in a variety of disciplines through actionable content, interactive feedback/help, and straightforward walk throughs. With a background in technology and entrepreneurship I have successfully navigated several complex challenges and learned a lot along the way - now it is my time to give back.

I am currently leading Software @ Microsoft and previously comp... 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. Getting Started With Apple Watch App Development: thing. Welcome to this course. Before we get started, I'd like to mention what we will be accomplishing and learning. In this entire course, we are going to be learning how to create Apple Watch APS for absolute beginners. We will be using the swift programming language, and we're going to explore a variety of things we could do and get you set up and ready to start building independently and to later on take calm or intermediate projects. The score is also includes a pretty nifty project. So without further ado, let's get right into it. So for this course, you're gonna need to have X code, and ex code is a free tool you can download from the APP store on your Mac. You, of course, will need a Mac for this course as well to develop. So once we have extra installed reeling, create a single view application, bringing ahead single view, we're gonna call this test. Let's actually, instead of calling a test, let's actually call it, uh, grocery list. Let's make it a little more interesting. We're gonna make sure Swift is selected, and we're gonna see this wherever we'd like. So let's keep this on our desktop. After we have this creative, we are going to add a apple watch target. So we're gonna hit file new target. We are going to select watch OS and click watch kit app we're gonna hit. Next we are going to type and here, grocery list watch given name that differs a little from grocery list. Since we're used it, we're gonna hit continue and you'll see that we now have these two folders and one is a apple watch target and the other is the extension. These files here are for the Iowa's counterpart up, but we're not gonna worry about this right now, So let's explore what we have going on in here and that'll do it for this video. So we have these two things created. What these two things are are as follows. This section here has everything that's user interface related. So this is where we will be creating our buttons and images and labels and interact herbal items right below it. We have this file which we will use to hold all our images and this extension bit down here has our interface controller and extension controller which are more or less is fancy file names. Ah, for our code to go in. So we are gonna put our code in here, and we're gonna have it interact with our buttons and images and such that we're gonna put in here. So that about does it for this video. So I would create this grocery list projects that you guys and follow along, Feel free to call it something else. And I will see you in the next lesson. Thanks. 2. 2. Outlets & Actions In Apple Watch App Development: Theo. Second lesson in the Apple watch app development. In this lesson, we're going to be covering outlets and actions. So without further ado, let's dive right in. So an outlet in action. The two concepts are very important for general development on Apple Walton also for iPhone APS. So let's start with outlets. So an outlet is as the name and kind of implies a way that we can hook up something in our code to something that we can see. So what the heck does that mean? So let's actually start with an example, as I think that's the best way we're gonna learn. So in that this ah file here, which is our interface storyboard, We're gonna focus on this right here, which is empty, right? And we're going to hit this, but in appear and we're going to drag on a button. Cool. So we have this, But in here now, imagine in our code, we wanted to change the title of this, and instead of having the same button, we wanted it to say tap me. So of course we can do that right here. What is clicking on it and editing it. But what if we wanted that to happen once something occurred, an event happened. So let's say you tapped it. And after you talked it, we wanted to say Tapped. Well, so reference this button in your coat, we're going to create an outlet for it. An outlet you can imagine. Like a outlet for a power cord in your house is the concept of connecting something visual here to a variable in our code. So let's actually go ahead and do that. So let's head to our interface controller that swift. Each interface controller represents a screen on her apple watch app. So we're going to create, appear and outwit an outlet, and you created by doing I'd be outlet like so it's a variable. You're gonna give it your own name, and you're gonna say it's of type You I Sorry, Not you. I bought in, but rather WK interface, but in So this is basically watch kit interface button. Now we have this outlet here and with out of this exclamation mark toe, let the program now that we're guaranteeing that this actually exists because we're gonna go ahead into our interface file here and we're going to connect that bit of code to the actual, but it here and that way we're going to do that is we're going to right click over here. The thing that owns that button and what I mean by own is wherever you typed it into. So we typed it into interferes controllers. So we're going to, right? Click this and boom! Look at that. We have our but in and hear my butt in. So we're gonna connect this little circle here tar, but in like so and there's a connection. So let's actually run our app by going up here selecting this middle one and making sure we pick one of these options, which is an iPhone plus an apple watch. And we're gonna hit this play, but and give it just a second. And while it's building our project, we're gonna head back to this interface controller and to stick with the example of what we want toe happen into the but And once it's Click, we were gonna basically code that example here the very little amount of code in just a second. So while that simulator is loading, let's start talking about actions. So an action similar to an outlet is the concept of some action occurring when you, when a user interacts of something in the interface environment? So a good example that's easier to follow is what happens when you select this button on my apple watch when I tapped his. But I want something to happen, right? So the way we do that is we want to fire a function. So we see these functions here, which is part of this template that exclude has given us. We are going to create another function, but we're gonna prefix it with I b action. Now we're gonna call it, make a function, and we're gonna call it but untapped. And when the button gets topped, we want to do something. Let's just print out some text for now. So similarly, how do we actually go and connect the but in tap this function to the actual physical user tapping the button in our interface builder weaken again, Right? Click the thing that owns that action and drag it to the thing that we want to fire that event, which is our button Cool. It's connected while we were going over this hour Simulator has launched and we could see here. It's just asking us to allow some things so we can start the app. Here's our app and we can see that we have this button and right now when we tap it, nothing happens now before we linked up this functions. And now let's rerun this application by pausing this and starting this again and you'll see in just a second when we tap on the button. We're gonna get some text printed out in exclude here as we defined in the function. So if we top it, remove this over who? Let's move this guy over. You can see we have some text there, So every single time we click on this button, we get that print. But what if we want to change the button from tapped? Initially, let's call this tap me, and every time the first time the user tops it, we should change the text of this attacked because we have an outlet in the action. When this action occurs, we can edit stuff about this outlet. When I say stuff, I mean attributes. The text of the button is considered an attribute, so in our function, but we can do is we can say my button, Let's set your title and let's call it tucked. So once this action occurs, we're gonna set the Buttons title Tuesday tapped. So let's stop this one more time and rerun our app and you'll see the first time the but and will say tat me. And once we click it, it'll change to tapped. Give it a second to load, and we have. This year we're going to click on this button and it seems attacked. So I hope that helps you understand what I be actions and I be outlets are. They are a very important concept in general Apple Watch development and even other development. To recap, Outlet is a connection from a bit of code to something in your user interface. An action is a function that you connect to an event trigger in your user interface. We demonstrated this through a outlet for a button and a action, respectively, that fires once that. But in this tapped, I hope you found this lesson informative, and I will see you in the next lesson. Thanks 3. 3. Create Tables In Apple Watch App Development: theme. Three An Apple watch app development. In the last lesson, we took a look at how to use outlets and actions, and in this lesson, we're gonna be creating tables. So to preface, a table is a list of cells, and in each cell we can put different elements. So, for example, you can have a list of contacts and we can put that in a table first and foremost, What we're going to start by doing is in our interface storyboard. We're gonna delete this, but in that we created in the last lesson and we're going to click this up here to get our user interface selection menu. We're going to search for a table and we're gonna drag on a table from here. We're gonna head back to the swift file and taint changes outlet we created from my butt in to my table its title change from WK interface. But into del UK interface table. We will delete this action that we created in the previous video. Let's also go ahead and delete these comments that were automatically created for us. A table displays one or more cells for each of ourselves. We need to create a template that we can reuse over and over in our table. You can see that we dragged on. There is already a table row controller in here, and this represents the actual cell. So let's go ahead and start designing this. Once we have a template of this cell, we can tell the table. Hey, create five of these cells. So to design it, we're gonna change. Once we've selected this group, we're gonna change the orientation over here in this menu, we have the group selected. We're gonna select this and we're gonna make the orientation of this vertical, and we're going to drag a label from our menu selection into here. We're gonna take this and expand it a little bit. And that's our design for the sake of this video and keeping things simple to get a reference to each of these cells that we create in this table, we need to add a file. So we're going to right click on our extension and click new file. It's gonna be a cocoa touch class and it's gonna subclass and this object and let's call it row controller and let's create it. Let's save it wherever it likes to save it in this class, let's create an I b outwit and let's call it my label and access watch kids stuff you need to import watch kit like so And this label is going to be of type WK interface label. Now we can have back to our interface storyboard, and we're going to say this row controller is of type of this row controller class that we made. And the way we do that is over here. We're gonna go to this tab and we're gonna say the class is row controller. Additionally, we're going to click on this and we're going to give this cell and identify where Let's just call it sell. And we're going to say it's not selectable for this video. And if you notice now if we right click this because this is of type row controller, we now see our my label outlook that we put in to this road controller. And the reason we did that is we're gonna now connect this my label to the label in this cell to finish up our actual table. We need to tell once this screen loads how maney cells we want. And for each cell we're gonna set the labels text. In this function, which is awake with context, we're going to be configuring the table to configure the table. We need to tell it how Maney cells, also known as Rose, to show and what type they're gonna be. We will do that by saying my table set number of rows and let's just say five for now, and the road type is going to be a string, and we called it cell in our storyboards will put cell there. We're also going to create an array in here. Now, we're just gonna put some fruits in it that we're gonna show in our table view. An array, if you're not familiar, is a collection of one or more items. So we're going to say apples, oranges, mangoes, grapes and let's go with some bananas. I don't recall if we've connected this outlet, so let's actually head back to this story board and see if we've connected the table. We have not. So let's take this my table and connected to this whole table. Let's go back to our code and the last thing we need to do is we need to say, for each of the rose in our table, we need a set, this particular string for it for the actual text. So we're going to say four fruit in array. We're going to say the row equals my table, uh, Roh controller at that position. So let's say X So what is X? So regulars say we have variable called X and zero initially, and after every time there's loop runs, we're gonna add one toe X and we do that by saying X plus equals one. All this row We're gonna save roe dot my label. Now we can't access my label because now Swift doesn't know that this row is of type row controller. And if you recall row controller is this file we made here. So we're gonna say Roe is this as road controller and now we should be able to say, Roe, stop my label set text and from this array, where did they get the text at that particular exposition? So the first time it zero So we'll get this string and then this string and the mist ring and so on and so forth, and this should be sufficient to actually build and run, and this is giving us a warning because we have this fruit here, but we're not using it. So that we could actually do is we can replace this with the actual fruit that we currently are at in our array, which will basically yield us the same results. So let's run and make sure we have everything working, and we can quickly do a summary and go over everything that we have done. So let's give this a second load, and we'll see our table like so we have five of these cells and we have apples, oranges, mangoes, grapes and bananas. Cool. So let's go back and let's revisit what we have done. We created an outlet for a table and we wrote some code in here. Let's get back to this. Before we wrote that code, we created this row controller file. It's a class of type road controller. We imported watch kit, which includes all over the watch user interface elements. We created an outlet for a label in our storyboard. We dragged in a table here and notice there's only one row. The notion of a table is you can create one template row and in the code you can specify. Hey, I want 10 of these or five of these and you can supply the data differently. We connected the outlet for the table we set on this cell that it has this identify air. We changed its class to be of type of Roe controller. We put a label inside of the cell and on the cell. We then, because we added a label, we connected the label to the label. We added, finally, to sum up in our function that gets called. Once the screen initially loads, we created an array of these fruits. We told the table that you're gonna have this many rose, and this is the type that we gave it in the storyboard. Then we created a simple for loop where we went over every element in our array, and we got a reference to that road controller. And for each of the rose we said on its my label said it's text to the given fruit and then out of one toe X. So when the next time the four loop runs through, it could be the next fruit, and that's about it. I hope you guys enjoyed this video. I found it helpful. I will see you in the next lesson. Thanks. 4. 4. Allow Text Input In Apple Watch App Development: Theo An Apple watch development. In this lesson, we're gonna be covering how to deal with text input from the user specifically with dictation. So if the user says something, we can capture what they say, and we can put it in her up. So we're going to start by adding a button and a label to our app. PSA. Let's find a but in Let's drag it on in and let's change the text on it, too. Tap me and let's go in the same menu and find a label. Let's drag this on in, and we can expand this from here. We're going to go back to our interface controller Swift file, and we're going to create an action for the but in an outlet for the label. So let's create and outlet for my label. It will be a type label, and let's create an action called but intact and what's going on? What's gonna happen is once we tap this, but and we should be presented with a way to enter text, and once we're done entering it in this case, speaking the text dictating it, our label should show whatever we've entered. So let's go back to our interface builder and connect our outlet in action. So are labeled. Goes to our label are but in tap to coast are but in in our swift file we are going to be using a nifty feature that's built into the Apple watch called a text text input controller . And that gives us options to let the user input text via the mic on the watch. Emojis animated emojis, etcetera. And to utilize it's pretty simple. We're going to basically do self the present input, text input groups, text input and suggestions. We're not gonna add any suggestions. This is if you want a pre fill some things where they could just happen enter in like a quick reply the allowed input modes air gonna be Let's just Teoh allow emoji and completion . This is we're gonna get her actual results. We're gonna first make sure we actually got a result on the user. Didn't hit done without entering anything in this case, speaking anything. So arguments, a guard let results results equal results, health return And what this is basically saying is make sure there is actually something in the results, right? Kind of a fancy way of saying it that what we're gonna do is we need to dismiss this text input screen and we want to update our labels text. Now we want to do both of those things immediately so the user can see it happening. And to do that, we want to do it on the main thread. If you're not familiar with reading, that's totally fine. I can make another lesson explaining it. Please feel free to put comments below or kind of just do a quick Google search of what that is. It's not really relevant to the beginner, Siri's. But stick with me here and we'll get this done. So we're gonna do operation q dot mean and we're gonna do at operation. And the two things we want to do is we want to dismissed this text input controller, and the other thing we want to do is we want to say my label, we want to set its text and we want the text to be the results and the first thing in the results as a string and that about does it. Once we run our up, we'll see that weekend input text of your dictation and from there it will up to in our label. So let's run our app on our watch really fast and give it a second to load and we'll see. We have a label here and our button bringing a tapper, but in which presents this nice controller. Or we can pick if we want to enter an emoji or use the mike to say something. So let's hit the mic and it'll start picking up. What we are saying will hit done, and we'll see that it has updated our label. Now label is not big enough, so it has cut off the end of our text because it's long. But in essence you get the main theme of the lesson. Celeste is recap super fast. So we've done here is we've created an outlet for the label so we can set its text via code . We have created an action and hopes it up to our but in in our action we present this text input controller. We say there is no suggestions. We allow emoji input and once it's completed, we get results in this block. We make sure that the results isn't empty. If it is empty, just returned out of here and never tries to go down here. Then we want immediate feedback. So we add in operation to this main thing. We dismiss this text in poet, and after that we update the labels text via the first thing in results, and we want to make sure to string so results is actually a collection of things that you get back. And that's just the way that APP was designed is we wouldn't get the first thing, which is the string, and we'll set it to our text label and when Goto a storyboard. And here we have our label and our button and we've connected an outlet to the label and a action to this button, and that about does it for this lesson. I hope you followed along and found it helpful. I encourage you to go through it again. Definitely leave a comment if you have any questions and I will see you in the next lesson . 5. 5. Create Multiple Screens In Apple Watch App Development: Theo back to another lesson in today's lesson. We're gonna be learning about how to add multiple screens in our apple watch app and to demonstrate this we're gonna actually just pick up with where we left off. In our previous lesson about in putting text, we are going to delete this label here and we are also going to change this text on this but into screen one. And what I want you to do is add two more buttons on here right below this 1st 1 and respectively, make it screen too. And screen three. Well, we're gonna now do is go back to our swift controller and we are going to delete this outlet as we don't need it anymore. Let's delete the code in Stieb of this action. And let's copy and paste his action two more times for the two new buttons we added, make sure we re name is so they're not redundant. And what we're gonna do is go back to our storyboard and see how to add a screen so you can see that we actually have these three other things here and these are actually the way that Apple lets you design what a notification looks like when you get it on your watch. But this is actually only screen we have this arrow on the left of this signifies that this is the first screen that our app opens up to. So what it wants you to do is hit this button right here and search for interphase controller. And we can drag on what's right on three of these guys one to and three. So an interface controller, in essence, is synonymous to a screen. One screen accounts toe, one interface controller and what we're gonna do is, let's I don't label to each of these and put some different text in it, so we know that they're different. So let's make this first label see first and and that one here. And let's also add one here. Let's make this one's a second in this one. Say third, and basically we can just hell, our first controller once you hit this. But in to show either these other any of these three screens and the way we identify a screen is with unidentified air so we can select this one. And on the right here we can actually specify that it has an identify ire in this menu, So let's call this one. First, let's select this guy and call this one second and let's select the last one and call this one third. So let's head back to our code now and where we can actually simply do need to these actions that we hooked up for the but ends are weaken do self dot push, and we can just give it a name of what screen to push. And context is if we want to pass in some data when we push it. So the 1st 1 that we want to push is this first screen. This one will be second, and this one will be third. So let's change this to second. Let's change this the third, and that about does it in terms of presenting screens so we can go ahead and hit run in X code, and it will run our application a Weiqing cycle through each of those buttons and hopefully get or three screens. So while that's loading up, quick recap we have are three actions here. No outlets. These three strings of 1st 2nd 3rd or the identify IRS. We gave in the storyboard in here and now it appears our app is loading up. So if we give this a few more seconds, we will see our initial screen, which has these three buttons, and we'll be able to tap them and hopefully see different screens. And here it comes, Cool. So if we hit our 1st 1 we get the first screen, we hit our 2nd 1 Well, it appears that nothing happens on her 2nd 3rd but And so maybe we forgot to actually connect the action. Ah ha! Which we did. So let's hook this up to this one. And let's hook this up to this one. Let's stop our AB and run it again. And what I want you guys to also take away from this lesson in this course is it's okay and make these little kind of mental hiccups and forget to do some of these things. As long as you're able to recognize what you forgot and go back in, you know, make that correction. So now if we slice any of these three buttons, we get our screen pushed and those labels are actually coming from here, and this should give you a pretty sties, an idea of how to connect different screens. And each of these screens are completely independent. So we can add an image on here or a table, as we saw in an earlier lesson in Or we can add a text input so on and so forth. So that about does it for this video. I hope you guys enjoyed it. Leave a like, leave a comment. Your feedback is very important to me and I will see you guys the next lesson. 6. 6. Saving Data In Apple Watch App Development: Theo. Another lesson in today's lesson. We are going to be learning how to save data in your apple watch app and let's give it into it. So if you recall we actually named this project grocery list and if that doesn't give it away, let me set some light. So are grossly grocery list. App will allow us to use the text input and, uh, basically speak out loud what we want to get from the store, and we should be able to save it and the display back to the user in a nice table. So I'm picking up exactly where we left off in the last video. So let's go ahead and delete these three screens that we made Hamas. We don't need them. Let's delete to these but ends and this button right here. Let's call this ad item. Let's head back to our code and delete to these actions. Um, let's change this action Teoh ad, but in tapped and let's add a label out with which is gonna be item, let's call it item label and make it a little more specific. It's gonna be of type label and what we're gonna basically be doing is we're gonna allow the user in this video to select the ad item, um, enter via their voice what item they want. And when they close the app and reopen it, that label will show whatever they saved last via input. So in this advert and tablets again, do a presentation of the text input control. Or like we did in a older lesson, this will be nil. This will allow Emojis, and our completion will be results in. We're gonna make sure there is indeed a result. And what we will be doing in here is we're gonna say self the item label. We're gonna set its text to results and the first thing in this as a string. And if you recall, we should also dismiss the text input that we have presented. And let's also wrap this inside of the operation that we talked about a couple lessons ago . So we make sure that it happens instantaneously like so and let's go connect our outlet and action as we've edited them in our code. So we probably have some funny things going on over here, So let's just connect that and connect this action and let's add a label so we can actually connect it to you. That label connect the outlet to the label and let's go ahead and right. Click this and drag this item label to this label. So right now, from earlier lesson, we saw that we could hit this basically speaking, speak something and the label will reflect whatever we spoke. But we close and reopen the app. Everything will reset. So how do we allow the user to see what they said last, In other words, save their entry. So there's something called user defaults, and it allows us to save values and keys. So a key could be something like item. And the value could be like apples. So a key maps to a value. So what we're gonna do in here is we're gonna right a simple way to get our keys and values from this user default thing. So let's say let user defaults. We're gonna create an instance of user defaults, make sure I spell that right, and it's gonna be user defaults. And when our app first loads we want to do is, we want to say that Idol labels we're gonna set the text and we want to do is what does he use your defaults, that I'm gonna get the value and we want to get the key for that value will be item, and this returns either the item, whatever is set for that value or nil. So we want to say, if this is nil, basically nothing was returned. Let's set the text empty and let's see if that's correct. Well, that's not correct, because we want to use this user defaults and hopefully value for key. This is gonna be item. And if this item comes back is nil. In other words, nothing is set. We are going to be showing the user, uh, an empty, empty label. And this is yelling at us because it saying cannot convert value of type, Any question mark. So we're going to say this value for key. This comes back as a string because we want to save a string right because the user is entering in some data and let's see, the user says banana as item they want, and we want to save it as a string. So every time, the uploads it will try to get from this user default save area, which is kind of like a think of it as a dump of things you can save, whatever the value for this item key is, and it'll be empty initially. Of course, once the user has inputted V, whatever they want, input the item, we want to save it here. Before we do that. Let's Ah, let's see why this is yellow. Get us So this is saying value of optional type any. So let's actually say result and put an exclamation mark Cuban that should satisfy it. Hopefully, maybe not. Let's see that I misspell something. So we're saying, Ah, this is why you forgot to put let in there. Let's fix this again. So that looks good to me. So the last thing we want to do here is after the label is updated to the text that the user has spoken, let's save it in user default. And the way we do that is on this user default variable. There should be a function called set value for key cool set value for keep, and we already know the key is item as we made up, um, and again askey could be anything that is a string, and here we're going to say we want to set this result as a string for this key and for some reason it doesn't like it. So let's actually get rid of the string and this should be sufficient, actually, apparently not. So let's see, it says reference of property user default. So he wants us to put itself before this, like so and again. I really want to stress. I'm not gonna be editing out these errors that I'm personally facing while I do these videos, as it's not a matter of being perfect. I'm not getting an error. Sometimes it's a little bit of an O moment where you kind of forget to do something. We overlook it, even after almost a decade of doing this type of development so totally normal and encourage you not to get discouraged by hitting errors. So let's go ahead and run this video. Uh, sorry. Run this application and while these boots up, actually, let's let's recap. So we have this action here in here. We are presenting the text input controller. We're assigning it the label. Once the user has it done, we're saving the data and its user default thing. Every time the APP opens, we wanna set the labels text to whatever this user default value is for the item key in the story board. We have hooked up the outlet for Evie label, and we have hooked up the action for the but in and I believe this it started. So let's see. So I label is here, but it has nothing in it. So it's like empty text because, as I mentioned earlier are, item has not been set yet. So let's hit this apples. So we hit done and we have apples here now. So now let's actually close the app hit pause and you can see back here the app is closed and let's run this one more time. And once the APP opens, the label should already say apples because that's what saved said. This opens up here and boom as we thought. We have apples here, and that about does it for this lesson. So saving data is very important and again keeping a theme with our grocery list application. You can imagine if we can save multiple items and somehow combine it with the table that we discussed in an earlier lesson. We can create a pretty nifty grocery list app. So that's where actually, we will be heading with all of these lessons. So I will catch you guys in the next lesson. Thanks. 7. 7. Images In Apple Watch App Development: Theo back to another lesson. An Apple watch development. Today we're gonna be taking a look at how to add images to our watch up. So let's get started exactly where we left off in the prior lesson. Let's delete this, but in and this label, let's head back to our swift file and get rid of all the stuff we added in here. So this stuff up here, let's get rid of this and this I be action, we wrote. We're gonna be taking a look at how to add an image to our project and then, more importantly, how toe have it show? It's pretty simple, but I wanted to make a separate lesson for it, as it's extremely important. And I mean, what are APS these days of that images? So what we want to start by doing is go after our storyboard and let's search for an image in this menu and we get this thing so it's dragged on an image. And just like any user interface element, we could have an outlet for this to set the image and set the um said, if it's hidden or not, and attributes about this. But how do we actually add an image? So for the sake of his video, I have gone to Google images and grabbed this Facebook logo icon, and we're gonna be adding this to our project. So let's head over to this file, which is assets, not XY assets. And this is where we can actually create asset catalogues, which hold one or more instances of our image. So what do I mean that one or more instances, so each image can have three different copies of different sizes. So let's see, your image is 100 pixels by 100 pixels. Within height, you can have 100 100 200 by 200 the 300 by 300. And the reason we could do this is because of if and when Apple comes out with newer devices that support higher resolution, the image that is more suitable for that device will be used that make sure that the equality under Apple looks top notch, regardless of if it's an older Apple lodge or a newer apple watch. So with that being said, let's actually create one of these. You'll notice that we already have this app icon um, pre Phil preset in here, and they're all these different sizes. So let's ignore this one for now. But let's right click and do new image set. Let's call it logo and we can see we have one next two X and three X in here. I have not edited the image for multiple sizes at the moment, but I want to explain to you what these were for the sake of its importance. We can just drag this in unless is drop it on the one X. Let's head back to our storyboard. And let's set the image of the image that we've dragged in here, the actual image property of it by tapping it and then here, typing in logo, you can notice that it is actually ah, it's stretched horizontally a little bit, and we can fix that by selecting and hear how we want the image to actually look so we can have it fill. It will cut off on the corners. We can have it fit. I'm so on and so forth. Of course, like I mentioned earlier, you can create an I B outlet in here and connected to your image. We're not gonna do that for the purposes of this video. But I wanted to just show how to add a basic image. So let's go ahead and run this app and give it a couple of seconds to load, and we will see our image. So up until this point, we've seen how to create multiple screens at Outlet, its actions, images like this one right here. We've seen how to add labels and but ends. How do you get input from the user via text? So we've seen quite a few things to create pretty nice applications. So that about does it for this lesson and coming up nice will do, but of a summary. And we will take a little intro into an overview of the project that is in store for you guys. So thank you so much for watching. And I'll see you in the next and final lesson. 8. 8. Wrapping Up Apple Watch App Development: Theo back to your last lesson in this course. This lesson will be more of a summary and a preface to the project in this course. So let's get right into it. So in this course, so far we have established a couple things. So the first thing is, what the heck and I be at what is and we learned how to create I be outlets. And here we've created one for a but and copy and paste is a few times. We can, of course, create one for a label and the table and an image etcetera, etcetera. And of course, let's not forget the change, the type for it here. This one is an image, and this one is a table and this one is a label. Of course, we learned how to present the input controller for a user to enter texture, speak text with the president Text input, control recall. We can put that inside of an I B action that we can connect to a but in. So let's go ahead and create in Ivey action function. And in this function we can present the text input controller and we can put Mylan here we don't want any suggestions we can put by. This allows emojis and the completion is results. And here and of course, we've seen how to add more screens and just our default one so we can go appear and weaken . Search for interface controllers weaken, drag as many as we want. Actually, there's no limit to this. And as you can imagine, we can create quite a large application for the Apple Watch with this method so we can create all of these. Of course, we also learned how to create a row controller file, but doing new file and it's a cocoa touched class. It's a N s object. We can call it row controller. It's important to know you can actually call this whatever you want. But a row controller is pretty nicely aligned with the vocabulary of what goes inside a table of you for each of the rows so we could put in outlets in here and we need to make sure we import watch kit and we can put in our outlets free to the rose in here, and we learned how to connect outlets and actions in our storyboard. We learned how to specify a dental fire for these new controllers that we've plopped on our storyboard by clicking on it and then going up here and specifying Ah and I identifier. We've learned how to present in the code another controller. And we do that by pushing it onto the scene. So that self dot push controller, we can put the name here and we can pass in data here. We would haven't really focused on this two month so we could do mill. For now, we've also learned how to save data and user defaults. We can create an instance of user defaults like so and on user defaults, weaken set values for keys. And we can get values for keys so we can say user defaults dot set value for key. And of course, we can say value for key, which will return what eyes available, what? Whatever values available for said key. And if there's nothing available, it'll return nil. Um, so, yeah, we've covered a great deal of, uh, content here and what I want to propose to you now. And this is available in the project description and outline. But I would like you to take everything here that you have learned and create a to do list slash a grocery list application. So, as you can imagine in grocery list application, I should allow the user to press a button and be presented with some text input. They should be able to speak whatever item they want to get at the store. And once they had done, we should save it. And the user should be able to enter multiple items, of course. And we should be able to save multiple items. Um, with that being said, we want to present a nice interface for them to see those items. So maybe instead of presenting them in a label, maybe we want to present all those items in a table and in a label in each of the cells for the table, we can show what the item waas. And so what? That being said, we want to be able to use our user defaults ah, saving mechanism to save multiple things and then later get those multiple things. So that is the challenge in the project that I am proposing to you all. And I really hope that, um, sufficiently been able to give you a decent understanding of these concepts and components to build out this grocery list. Slash to do list app. It's something that it's fairly, uh, decently. Easy slash? Well, breath of information to do. It's not something that you could put together in two seconds, but it's also not the hardest thing in the world. And I really encourage you to put comments on this lesson and reach out if you need any help. And, um, let me know if this any other way that I could be of more help. Let me know if there's any feedback for this entire course. I really appreciate you guys watching it, especially if you've gone all the way through and you got to this point, Um, yeah, and I will see you in another course. I hope you enjoy it. Have a good one.