1 00:00:00,570 --> 00:00:07,650 Right, so let's discuss exactly what all these files are and folders, first of all, we can ignore 2 00:00:07,650 --> 00:00:09,390 these products folder. 3 00:00:09,510 --> 00:00:10,980 Just leave that alone for now. 4 00:00:11,550 --> 00:00:16,590 What we're interested in is this screen torch folder, which is the name of our application. 5 00:00:17,580 --> 00:00:21,770 The very first thing that we need to know about is this file called the app delegate. 6 00:00:21,780 --> 00:00:27,330 And if you go ahead and click that, then you'll see we get a bunch of code, a bunch of functions inside 7 00:00:27,330 --> 00:00:29,100 of a class called App Delegate. 8 00:00:29,730 --> 00:00:35,640 Don't worry about what these things are, but basically this is how the system communicates with your 9 00:00:35,640 --> 00:00:36,470 application. 10 00:00:36,810 --> 00:00:43,560 So, for example, if your application is about to be backgrounded or about to be killed by the system 11 00:00:43,560 --> 00:00:48,340 because it's consuming too many resources, then app delegate will be informed. 12 00:00:48,690 --> 00:00:50,190 Now, there's a bit more to it than that. 13 00:00:50,190 --> 00:00:52,490 But that's the basic idea of an app delegate. 14 00:00:52,770 --> 00:00:54,600 The app delegate also connects. 15 00:00:54,600 --> 00:00:55,890 Let's say you want to play music. 16 00:00:56,040 --> 00:00:59,960 It connects out to the system so the system knows which music you want to play. 17 00:00:59,970 --> 00:01:02,610 It can hand over the playback and job done. 18 00:01:03,120 --> 00:01:07,380 That's one thing I love about programming for iOS as opposed to Android. 19 00:01:07,740 --> 00:01:12,510 There are little things like that, like here's a track, just go ahead and play it that it just takes 20 00:01:12,510 --> 00:01:16,460 all the load off your hands and iOS just does the work for you. 21 00:01:16,500 --> 00:01:17,340 It just works. 22 00:01:17,460 --> 00:01:18,060 It's true. 23 00:01:18,780 --> 00:01:22,560 Well, it just works is our famous last words, aren't they. 24 00:01:22,620 --> 00:01:23,910 It doesn't always just work. 25 00:01:24,570 --> 00:01:24,870 Right. 26 00:01:24,870 --> 00:01:26,670 So that's the app delegate. 27 00:01:27,450 --> 00:01:33,900 Now we have the scene at Delegate and because this has the word delegate in it, this takes care of 28 00:01:33,900 --> 00:01:41,190 all the communication between what's happening in your scene, i.e. on the screen and this system and 29 00:01:41,190 --> 00:01:42,030 the app delegate. 30 00:01:42,300 --> 00:01:44,010 So that's basically what this does. 31 00:01:44,160 --> 00:01:50,610 And if you look at the names of these functions, we have a scene did disconnect or a scene became active, 32 00:01:50,610 --> 00:01:54,150 i.e. it was shown or a scene will resign active. 33 00:01:54,150 --> 00:01:55,740 So they're very specialized. 34 00:01:55,740 --> 00:02:02,070 What we call hooks in this, the hooks allow us to be notified when these particular things happen. 35 00:02:03,000 --> 00:02:07,590 So, for example, if you've got a little game and it's going backgrounded, you might want to save 36 00:02:07,590 --> 00:02:09,120 the player data and pause the game. 37 00:02:09,330 --> 00:02:13,380 And this is kind of where you would do that, right? 38 00:02:14,640 --> 00:02:16,380 So that's gone over to one side. 39 00:02:16,380 --> 00:02:18,660 That's basically how we're communicating with the system. 40 00:02:19,320 --> 00:02:24,720 Now, the view controller controls the view, right? 41 00:02:24,720 --> 00:02:25,650 It inherits. 42 00:02:26,490 --> 00:02:32,250 If you've taken my basic shift course, which I hope you have from the UI view controller, user interface 43 00:02:32,250 --> 00:02:39,030 view controller, this is in charge of controlling the view and nothing else. 44 00:02:40,050 --> 00:02:46,860 But but people often put a lot of code in The View controller, myself included. 45 00:02:47,040 --> 00:02:52,070 And for the purposes of teaching you how to code on iOS, I kind of have to. 46 00:02:52,080 --> 00:02:55,050 Otherwise, things get very convoluted, very fast. 47 00:02:55,650 --> 00:03:01,740 So just bear in mind, if you're taking a beginner course, such as this first part, then what you 48 00:03:01,740 --> 00:03:05,670 see is correct code, but it may be in the wrong place. 49 00:03:05,670 --> 00:03:09,330 It's not quite refracted into the correct locations. 50 00:03:09,570 --> 00:03:16,350 If you want to see that kind of thing, then search for I am Dev, build it be you I ldi it all. 51 00:03:16,350 --> 00:03:19,650 One word in those particular courses. 52 00:03:20,220 --> 00:03:27,300 I go through every app step by step without preplanning it so you can get a real feel for how we structure 53 00:03:27,300 --> 00:03:27,660 code. 54 00:03:28,410 --> 00:03:34,500 So that's the view controller if you controller controls in this case the main storyboard. 55 00:03:35,280 --> 00:03:37,380 So this at the moment is a blank screen. 56 00:03:37,380 --> 00:03:42,630 But if I click the blank screen, we get this little pop up at the side here and I'm sorry these things 57 00:03:42,630 --> 00:03:50,310 are so tiny, but Apple, with all of their accessibility rules for apps, will not give you accessibility 58 00:03:50,310 --> 00:03:51,000 in X code. 59 00:03:51,000 --> 00:03:52,770 So I can't increase the font of these. 60 00:03:53,400 --> 00:03:58,500 The only fonts I can increase are over on the far left hand side and the main font for code. 61 00:03:59,190 --> 00:04:00,120 Would you believe it? 62 00:04:01,080 --> 00:04:03,270 I mean, it really missed the target sometimes anyway. 63 00:04:04,440 --> 00:04:05,490 That's how storyboard. 64 00:04:05,500 --> 00:04:08,640 So that's the main screen controlled by the View controller. 65 00:04:09,390 --> 00:04:13,020 Then we have this little folder called Assets Dot XY assets. 66 00:04:13,440 --> 00:04:18,180 This is where will store images, icons and things like that, which we're not touching right now. 67 00:04:19,240 --> 00:04:24,790 We have another storyboard, a launch screen storyboard, and as you'd imagine, this is what shows 68 00:04:24,790 --> 00:04:26,160 when the user launches your app. 69 00:04:26,650 --> 00:04:33,310 And finally, we have an info dot, please look at that tiny, tiny, tiny font. 70 00:04:33,490 --> 00:04:34,390 I can't even zoom in. 71 00:04:34,390 --> 00:04:37,050 And out of it is TrackMan plus at. 72 00:04:38,740 --> 00:04:47,740 Anyway, these allow you to select it's basically a dictionary of preferences and things like that that 73 00:04:47,740 --> 00:04:48,810 apply to your app. 74 00:04:48,820 --> 00:04:52,320 So we have like a bundle name, we have a bundle version. 75 00:04:52,900 --> 00:04:58,510 This is all the stuff that the App Store needs to pick up in order to update your app. 76 00:04:58,510 --> 00:05:05,260 When you update your app to show the end user what version this is and various other bits and pieces 77 00:05:05,260 --> 00:05:05,620 like that. 78 00:05:05,650 --> 00:05:07,900 So basically, it's a bunch of properties. 79 00:05:08,860 --> 00:05:12,250 We also have some things down here related to the display. 80 00:05:12,550 --> 00:05:16,640 So Interface Orientation's is this a landscape or a portrait app? 81 00:05:16,810 --> 00:05:19,480 How many of those portraits and landscapes can we use? 82 00:05:19,480 --> 00:05:20,950 Can we turn the item upside down? 83 00:05:21,280 --> 00:05:23,690 All defined pretty much here. 84 00:05:24,310 --> 00:05:26,130 So those are the basic files. 85 00:05:26,140 --> 00:05:31,510 Now, most of your work is going to be done in The View controller. 86 00:05:32,370 --> 00:05:38,400 You will do some in the scene delegate, and very rarely you'll do some in the ALP delegate, most has 87 00:05:38,400 --> 00:05:39,990 done an interview controller. 88 00:05:40,350 --> 00:05:44,190 There is one view controller per screen, right? 89 00:05:44,760 --> 00:05:49,680 We never, ever want to have sort of a view controller that controls two screens because you're going 90 00:05:49,680 --> 00:05:51,690 to get a lot of crosswise and you don't want that. 91 00:05:52,510 --> 00:05:55,730 So that's your little tour around a basic east project. 92 00:05:55,750 --> 00:05:56,380 Let's move on.