1 00:00:01,230 --> 00:00:05,170 So work come back again this is probably the lesson you have been waiting for. 2 00:00:05,170 --> 00:00:08,330 How to use faith in us. 3 00:00:08,390 --> 00:00:09,210 I'm not going to talk. 4 00:00:09,210 --> 00:00:10,590 I'm just going to jump into school. 5 00:00:10,600 --> 00:00:11,970 They showed you how to use it. 6 00:00:11,980 --> 00:00:17,980 And when I go to execute the command shift and file our I was single view application I'm going to call 7 00:00:17,980 --> 00:00:25,460 it my swift virus app and the only thing I want to make sure I change is the language should be left 8 00:00:25,500 --> 00:00:26,660 out Swift. 9 00:00:26,740 --> 00:00:31,640 So with the language shift I'm going to say next I'm going to place it somewhere eventually. 10 00:00:31,930 --> 00:00:36,040 I mean here the big difference that jumps out is this. 11 00:00:36,040 --> 00:00:39,410 We don't have a dot H and a dot and file anymore. 12 00:00:39,430 --> 00:00:44,190 Everything is inside of one file called View Controller at Swift. 13 00:00:44,200 --> 00:00:49,420 So if in the past you avoid the body of your controller that age you can't alter that and make that 14 00:00:49,450 --> 00:00:50,520 a storyboard. 15 00:00:50,530 --> 00:00:56,770 Now you only worry about view Concordat Swift and the main storyboard so everything is in one place 16 00:00:56,800 --> 00:00:58,380 inside our view controller. 17 00:00:58,390 --> 00:01:03,940 Right now I'm going to get rid of all the comments and some things should begin looking familiar to 18 00:01:03,940 --> 00:01:04,500 you. 19 00:01:04,540 --> 00:01:12,180 So we have this thing new controller of the type you view controller the same way we had at interface 20 00:01:12,190 --> 00:01:15,040 View Controller Carlo View Controller. 21 00:01:15,130 --> 00:01:20,860 We have this guy view that lot with superb view that it and the one question you might be asking and 22 00:01:20,860 --> 00:01:22,610 that's a very valid question. 23 00:01:22,660 --> 00:01:28,630 Where do I put my outlets because in the past we used to do all of our the outlet declarations inside 24 00:01:28,630 --> 00:01:29,490 the dot H. 25 00:01:29,490 --> 00:01:30,040 Fine. 26 00:01:30,100 --> 00:01:33,390 So I'm going to get myself a little bit of space in here. 27 00:01:33,490 --> 00:01:38,020 You don't need to worry about these declarations and definitions in a few lessons. 28 00:01:38,020 --> 00:01:44,160 Now when we go to the next section which is more of you know hard core programming I will talk about 29 00:01:44,260 --> 00:01:50,170 object oriented programming and what is a class and what's a superclass and what are the methods which 30 00:01:50,170 --> 00:01:51,860 are the functions of a class. 31 00:01:51,920 --> 00:01:52,540 What are these. 32 00:01:52,540 --> 00:01:55,480 You know you control our life cycles. 33 00:01:55,530 --> 00:01:56,980 Will cover all of these. 34 00:01:57,000 --> 00:02:03,040 But what you need to worry about right now is this right after your class declaration and inside the 35 00:02:03,040 --> 00:02:07,660 body of your class you want to put all of the outlets. 36 00:02:07,810 --> 00:02:10,040 So this is where we put all the outlets. 37 00:02:10,060 --> 00:02:11,230 So let's see how we do that. 38 00:02:11,230 --> 00:02:15,700 I want to go to a storyboard and in my story about I'm going to make two things. 39 00:02:15,700 --> 00:02:25,090 One is and by then as usual and the other one is a label kind of as usual. 40 00:02:25,380 --> 00:02:27,760 And I'm going to change any of their properties here. 41 00:02:27,760 --> 00:02:33,460 I actually want to do all of these properties by programming so not only do you get to see swift We 42 00:02:33,460 --> 00:02:36,460 also get to see some newer stuff as well. 43 00:02:36,690 --> 00:02:44,010 So let's go to assistant editor and yes Destinator I'm going to drag the Padan in here say it is my. 44 00:02:44,210 --> 00:02:52,690 Then I'm going to drive the labeling here say it is my label and I'm going to either I get the button 45 00:02:52,960 --> 00:02:58,090 changed the type into an action and say this is my action. 46 00:02:58,240 --> 00:03:00,760 So whenever it is being touched up inside. 47 00:03:00,760 --> 00:03:02,270 Call this action. 48 00:03:02,710 --> 00:03:03,930 And that's about that. 49 00:03:04,000 --> 00:03:04,950 So diking. 50 00:03:05,050 --> 00:03:08,620 And just like the way we did with the objective see if we are doing it in the street. 51 00:03:08,860 --> 00:03:11,880 So let's go back to our editor and our view controller. 52 00:03:12,070 --> 00:03:19,660 I have two outlets in the past they were being written something like this at profit the non tarmac 53 00:03:19,690 --> 00:03:22,030 which is the default behavior here. 54 00:03:22,240 --> 00:03:30,490 And then I beat out that you are label or you or I but then and then asked to X which we don't have 55 00:03:30,490 --> 00:03:31,100 at all. 56 00:03:31,150 --> 00:03:32,110 In. 57 00:03:32,140 --> 00:03:34,520 We don't need to have pointers for anything. 58 00:03:34,520 --> 00:03:36,010 We will talk about the standards. 59 00:03:36,020 --> 00:03:36,350 Right. 60 00:03:36,370 --> 00:03:41,920 Why it is like that is with under the name of our outlets so my label. 61 00:03:42,070 --> 00:03:48,790 So even though this isn't exactly the same format it has some similarities with what we had in Objective-C 62 00:03:48,800 --> 00:03:54,970 and that's the only thing that matters right now for you to feel that well this kind of is similar to 63 00:03:54,970 --> 00:03:59,650 that until we get a better sense of what they are and how they work and everything. 64 00:03:59,650 --> 00:04:03,930 So to do actually something functioning is what I'm going to do. 65 00:04:04,090 --> 00:04:10,780 I'm going to go to my view with a lot and in my view it the Lord I'm going to say my but then DOD background 66 00:04:10,810 --> 00:04:14,440 color and is telling me you have to give me a new color. 67 00:04:14,680 --> 00:04:18,390 I'm going to say it's you eye color dark dark gray. 68 00:04:18,820 --> 00:04:27,700 And then I'm going to say my body in the title color and title colors or titles have to be set for a 69 00:04:27,700 --> 00:04:29,440 certain state. 70 00:04:29,520 --> 00:04:36,210 Some say set title color who you are a color that too white for you. 71 00:04:36,210 --> 00:04:44,660 I control the state DOT Norman and I'm also going to say my part in Dardis said Titel. 72 00:04:44,890 --> 00:04:47,380 Where is that title. 73 00:04:47,400 --> 00:04:49,580 Another tribute the title title. 74 00:04:49,810 --> 00:04:56,170 I'm going to set title to hits me for you or I control the state DOT Norman. 75 00:04:56,500 --> 00:05:03,620 So as you can imagine this is a method that you're calling from you I Baden's in this case but then 76 00:05:03,920 --> 00:05:09,800 it takes into work humans and it does something it sets up something on our button. 77 00:05:09,800 --> 00:05:15,770 So if you run this now we should be able to see our But then with the dark background of white text 78 00:05:15,770 --> 00:05:18,860 color and a title on it that says hits me. 79 00:05:18,860 --> 00:05:20,980 Let's see if that's the case. 80 00:05:22,600 --> 00:05:23,060 Great. 81 00:05:23,080 --> 00:05:23,980 Now let's look at it. 82 00:05:23,980 --> 00:05:26,720 It says to me the background is dark gray. 83 00:05:26,740 --> 00:05:29,180 I know I want to change some things in the label. 84 00:05:29,400 --> 00:05:37,540 I'm going to to my action and my action I'm when I say my label the background color is you eye color 85 00:05:37,590 --> 00:05:48,400 that orange and I'm gonna say my label the text color is going to be you eye color dot black and I'm 86 00:05:48,400 --> 00:05:52,680 going to say my label doesn't text alignment. 87 00:05:52,690 --> 00:05:54,730 Now here's a bit of a difficult one. 88 00:05:54,730 --> 00:05:58,120 We don't know what we should feed to a text alignment. 89 00:05:58,270 --> 00:06:04,610 I kind of knew that this is a color and that I would use the operation the auto completion of ex-coach 90 00:06:04,630 --> 00:06:08,790 tells me hey these are the colors and that's you know kind of you know expect that. 91 00:06:08,800 --> 00:06:10,350 But what about text alignment. 92 00:06:10,360 --> 00:06:15,440 It tells me you have to feed me with something called and there's text alignment. 93 00:06:15,670 --> 00:06:17,300 So I'm going to say OK so. 94 00:06:17,370 --> 00:06:25,830 And that's text align and that's text and lineman's and then and then I thought the dot operation under 95 00:06:25,880 --> 00:06:33,120 some very familiar names center justified left Nashar blah blah I'm going to use the Center for here. 96 00:06:33,310 --> 00:06:36,520 I want to get I say my label dot font. 97 00:06:36,520 --> 00:06:38,960 And it says you have to give me a new iPhone. 98 00:06:39,280 --> 00:06:46,730 I'm going to say it's you I want to dot and then here one of them the when I know I want to use is called 99 00:06:47,080 --> 00:06:49,520 System font of size. 100 00:06:49,600 --> 00:06:55,100 And I want to use a larger font let's say 26 I want to make it a lot larger. 101 00:06:55,180 --> 00:07:03,580 And finally I want to say my labels don't text or text alignment text itself and you see it here and 102 00:07:03,590 --> 00:07:08,520 here says you have to give me a string an optional list thing because it could be nil. 103 00:07:08,800 --> 00:07:15,020 So I'm going to say text is going to be hello hello. 104 00:07:15,490 --> 00:07:20,400 So if it works I'm sure you can guess what we are going to see. 105 00:07:20,800 --> 00:07:27,940 Once my application launches on my iOS 8 simulator hits me Hallsworth. 106 00:07:28,390 --> 00:07:35,530 So that's about that vus are strafed with iOS very similar to how we did Objective-C. 107 00:07:35,530 --> 00:07:38,970 Swift is a lot easier to learn and to work through. 108 00:07:38,980 --> 00:07:45,340 There's a lot easier to are to together started with things that you need to remember is not unlike 109 00:07:45,340 --> 00:07:52,480 Objective-C Strief doesn't have two files in and yet is only one file that is you can two or three if 110 00:07:52,750 --> 00:07:59,890 you do all of your declarations up there and then you have your functions on your life cycles and then 111 00:07:59,890 --> 00:08:06,610 everything is the only primary difference is things are based on a dot operation. 112 00:08:06,610 --> 00:08:13,720 If you want to get the same thing in Objective-C we had to say something like you I fonds and then that 113 00:08:13,820 --> 00:08:20,570 space system a font of size and then do something like you know close the brackets in here. 114 00:08:20,740 --> 00:08:27,260 But since this we used to just use the dot operation you want that system a font and it sticks in my 115 00:08:27,420 --> 00:08:28,710 data center. 116 00:08:28,860 --> 00:08:34,170 You control the state data normal which truly simplifies our process. 117 00:08:34,370 --> 00:08:41,400 Color dot dark gray as opposed to saying you eye color is space dark gray. 118 00:08:41,650 --> 00:08:43,190 So that's about that. 119 00:08:43,240 --> 00:08:47,500 Let's keep that in mind and we'll move on to our next lesson.