1 00:00:00,420 --> 00:00:03,590 So let's go ahead and create our app, you should be pretty used to doing this by now. 2 00:00:04,380 --> 00:00:12,360 I've got into Xcode and hit new project that's hit next on app and let's paste in that ID that we recorded 3 00:00:12,360 --> 00:00:13,610 in the previous section. 4 00:00:13,950 --> 00:00:16,790 So this is the ID that we gave our FIREBASE app. 5 00:00:17,040 --> 00:00:18,950 We have to make sure that these are the same. 6 00:00:19,470 --> 00:00:24,990 We want to storyboard UI kit app delegates swift and leave all the rest unchecked. 7 00:00:25,680 --> 00:00:26,520 Click next. 8 00:00:27,690 --> 00:00:33,540 And we're going to drop this into the source code of my particular folder here. 9 00:00:34,230 --> 00:00:37,110 I have some old source code there, but let's create a new one. 10 00:00:40,100 --> 00:00:42,110 Shot, shot, fired three. 11 00:00:45,190 --> 00:00:46,660 And it creates. 12 00:00:49,130 --> 00:00:55,400 So that should go ahead and do what it needs to do, right, we're in now, what's the first thing we 13 00:00:55,400 --> 00:00:55,940 have to do? 14 00:00:55,970 --> 00:00:57,260 Well, let's expand this. 15 00:00:57,530 --> 00:01:02,710 And if you recall in our Fireback section, we downloaded this config file up top here. 16 00:01:03,290 --> 00:01:04,850 So let's go ahead and add that. 17 00:01:05,360 --> 00:01:10,850 Let's right click this folder and let us go for where is it now? 18 00:01:12,720 --> 00:01:17,820 And file that they add files to come up, G.K microdot, et cetera. 19 00:01:18,450 --> 00:01:20,670 So what we're going to do is go to our downloads. 20 00:01:22,930 --> 00:01:24,340 Go today, modifieds. 21 00:01:25,690 --> 00:01:28,130 Google service info dash to dot, palest. 22 00:01:29,290 --> 00:01:35,110 I'm just going to double click that important, but to make sure that things work, I'm going to press 23 00:01:35,110 --> 00:01:39,610 enter on it and I'm going to remove the Dashty because that should be the actual name of it. 24 00:01:41,050 --> 00:01:44,560 OK, now you'll notice this place has, of course, a bunch of properties. 25 00:01:44,920 --> 00:01:51,730 We've got a client ID reversed, client ID, API, key, etc. a whole bunch of things. 26 00:01:52,710 --> 00:01:58,290 OK, so we got also very interesting is ads enabled, currently set to zero. 27 00:01:58,570 --> 00:02:03,040 So we might want to change those if we want to make advertising revenue from our apps. 28 00:02:03,460 --> 00:02:08,560 And just so you know, a messaging app is actually a very good ad revenue generator because people are 29 00:02:08,560 --> 00:02:10,780 looking at the screen all the time. 30 00:02:11,000 --> 00:02:14,400 OK, let me give you an example of a bad revenue generator. 31 00:02:14,590 --> 00:02:18,880 It would be something like a music app where you set a playlist going and then you switch the screen 32 00:02:18,880 --> 00:02:19,120 off. 33 00:02:19,570 --> 00:02:24,590 And so the user is not looking at ads during that time, which is why games earn a lot more. 34 00:02:24,640 --> 00:02:28,930 It's not the only reason they earn a lot more, but they earn a lot more in ads because that's one of 35 00:02:28,930 --> 00:02:32,270 the primary reasons you're staring at the screen the whole time. 36 00:02:33,130 --> 00:02:40,420 So, I mean, I do know music apps that make a whole bunch of money on ads, so it's not a lost cause 37 00:02:40,420 --> 00:02:41,110 by any means. 38 00:02:41,320 --> 00:02:45,910 But apps like this where people are staring at the screen are likely to earn you a lot more. 39 00:02:46,600 --> 00:02:52,090 OK, so that's the service info we're in, except we don't have any firebase installed in the app. 40 00:02:52,570 --> 00:02:58,110 Now, if we go to the Ad Firebase SDK, it tells us we should use part files. 41 00:02:58,480 --> 00:03:00,250 I don't really want to use cocoa pods. 42 00:03:00,580 --> 00:03:03,460 What I want to use is the Swift package manager. 43 00:03:04,000 --> 00:03:06,000 So let's have a look here. 44 00:03:06,010 --> 00:03:12,280 Swift package manager for what is it, Firebase? 45 00:03:12,950 --> 00:03:14,560 So if you go to the firebase. 46 00:03:17,360 --> 00:03:24,020 Probably here, the second option on GitHub, it'll tell you how to use the package manager. 47 00:03:26,060 --> 00:03:31,400 And what you need, so analytics, so if you're going to add analytics, you have to add a link or option. 48 00:03:31,400 --> 00:03:35,090 I won't go into that, but just say, you know, you can look it up yourself if you need it. 49 00:03:37,400 --> 00:03:42,770 Installation, if you've used cocoa pods before to install Firebase, then definitely remove it first 50 00:03:42,780 --> 00:03:44,260 using the method they say there. 51 00:03:44,720 --> 00:03:48,800 But in Xcode we want to get the SWIFT package manager in files with packages. 52 00:03:49,220 --> 00:03:52,850 And then this is the important section to copy this. 53 00:03:55,250 --> 00:04:05,420 So if packages out a dependency, drop this in and then go ahead and let it pass everything right, 54 00:04:05,420 --> 00:04:11,630 so the first thing it's going to ask you for is the version now, because this is fairly new, there 55 00:04:11,660 --> 00:04:13,620 are some version notes to look out for. 56 00:04:14,810 --> 00:04:19,850 So prior to seven versions, selection is not available and. 57 00:04:23,420 --> 00:04:28,370 OK, I know I did have an issue with this a little while back, so we're going to have up to next, 58 00:04:28,370 --> 00:04:28,840 Major. 59 00:04:29,150 --> 00:04:33,470 So it's going to take the current version, which is about sex, and it will keep upgrading it until 60 00:04:33,470 --> 00:04:35,450 we get to seven or just before seven. 61 00:04:35,690 --> 00:04:36,980 And it won't go any further. 62 00:04:37,250 --> 00:04:40,070 That's in case you break your own application. 63 00:04:40,310 --> 00:04:43,910 So, of course, you can change all of this much later on if you need to. 64 00:04:43,910 --> 00:04:50,960 But you need to be aware that whenever there are major upgrades in software, there will be things that 65 00:04:51,110 --> 00:04:52,970 break is just the way it is. 66 00:04:53,930 --> 00:04:58,700 Usually they're fairly good at telling you what's broken and how to solve it and what to watch out for 67 00:04:58,700 --> 00:04:59,860 before you even upgrade. 68 00:05:00,230 --> 00:05:06,050 So it's worth looking at the notes before you just tap that upgrade button nilly and then give yourself 69 00:05:06,050 --> 00:05:11,990 three days of hair pulling out headaches because you thought it would just work. 70 00:05:11,990 --> 00:05:14,050 But that ain't how software works. 71 00:05:14,300 --> 00:05:16,550 It never does just work. 72 00:05:17,640 --> 00:05:20,120 So this is endlessly resolving. 73 00:05:21,380 --> 00:05:22,580 I don't know what that's about. 74 00:05:24,190 --> 00:05:27,200 I'll take a little pause here, right? 75 00:05:27,310 --> 00:05:28,540 So that was a pain. 76 00:05:29,530 --> 00:05:34,930 What I had to do was add the swift package and specify Fergin seven point zero point zero. 77 00:05:35,410 --> 00:05:39,640 The other versions might have worked, but they just looked like they weren't resolving at all. 78 00:05:40,430 --> 00:05:44,530 OK, so once it actually resolves, you should get presented with something like this. 79 00:05:44,860 --> 00:05:46,730 You can start to include the packages you need. 80 00:05:46,750 --> 00:05:47,850 So we want analytics. 81 00:05:47,860 --> 00:05:49,930 We definitely want authentication. 82 00:05:50,060 --> 00:05:52,590 Otherwise, how can I use this log in and post data? 83 00:05:53,260 --> 00:05:55,810 We want the database crash politics. 84 00:05:55,810 --> 00:05:56,860 You can leave out for now. 85 00:05:56,860 --> 00:05:57,640 We don't need that. 86 00:05:58,240 --> 00:06:00,130 We'll have firestorm in there. 87 00:06:00,660 --> 00:06:02,440 Uh, Firestones with Peter. 88 00:06:03,820 --> 00:06:08,700 Firebase functions now, you can actually add all of this later on, functions of those cloud functions 89 00:06:08,710 --> 00:06:15,310 I told you about in a previous lecture, Firebase installation's firebase messaging, firebase storage 90 00:06:15,310 --> 00:06:17,010 and storage, swift beta. 91 00:06:17,320 --> 00:06:20,440 So, again, as I say, we can come back and change these later on. 92 00:06:20,440 --> 00:06:24,300 But I'm just going to select those is a good general selection to start with. 93 00:06:24,790 --> 00:06:27,610 Now that's going to go off and fetch everything it needs to do. 94 00:06:28,390 --> 00:06:35,440 Whilst we do that, you'll notice that I no longer have my list file in here because the whole thing 95 00:06:35,440 --> 00:06:36,580 was failing to compile. 96 00:06:36,580 --> 00:06:39,560 So I just started again in case something got stuck. 97 00:06:40,090 --> 00:06:45,580 That's a fairly good idea, a fairly good strategy if your items get stuck to do that. 98 00:06:46,510 --> 00:06:48,750 OK, so we've got our list in there. 99 00:06:48,790 --> 00:06:50,200 Let's again, change that name. 100 00:06:53,360 --> 00:07:00,530 I also think I did something wrong with you guys there, the bundle ideas chitchat, and I think when 101 00:07:00,530 --> 00:07:04,850 I was installing this here, I got it slightly wrong with you. 102 00:07:04,860 --> 00:07:07,770 So let's check out our info. 103 00:07:08,060 --> 00:07:13,400 Please note, we want the Xcode project info. 104 00:07:15,620 --> 00:07:20,450 Where is it I'm losing it, stay, guys, I've forgotten where all the stuff is. 105 00:07:21,320 --> 00:07:25,070 Let's right click it and see if we have properties and we don't know what. 106 00:07:25,640 --> 00:07:28,500 I'll just solve that problem, cross that bridge when we come to it. 107 00:07:29,810 --> 00:07:30,970 OK, so you got a bundle. 108 00:07:30,980 --> 00:07:31,870 Everything's working. 109 00:07:32,240 --> 00:07:35,390 I believe our packages should now be installed. 110 00:07:35,780 --> 00:07:41,420 If you look right up at the very top of Xcode, we are indexing these files because as you'd imagine 111 00:07:41,420 --> 00:07:45,290 from those packages, there are a lot of files to index. 112 00:07:46,260 --> 00:07:46,910 All right. 113 00:07:46,910 --> 00:07:49,760 That indexing is pretty much done now after a little break. 114 00:07:50,210 --> 00:07:52,730 The next thing we have to do is initialize Firebase. 115 00:07:53,030 --> 00:07:54,830 So we're going to import Firebase. 116 00:07:54,830 --> 00:07:58,900 And the only line we need is down here, which is Firebase Dot Configure. 117 00:07:59,420 --> 00:08:02,810 So let's copy that over to the clipboard and I'll show you where to put that. 118 00:08:02,840 --> 00:08:04,100 It's an app delegate. 119 00:08:04,320 --> 00:08:05,500 Let me just double check that. 120 00:08:05,960 --> 00:08:08,300 Yes, it did finish launching with options. 121 00:08:09,230 --> 00:08:12,200 So it is usually the very first thing that's listed here. 122 00:08:12,200 --> 00:08:16,490 But make sure it is this particular one and set down here before we return. 123 00:08:16,490 --> 00:08:16,850 True. 124 00:08:17,270 --> 00:08:22,490 We're going to have Firebase App Configure and that's going to give an error because we haven't yet 125 00:08:22,490 --> 00:08:24,560 imported Firebase. 126 00:08:25,850 --> 00:08:27,670 OK, go ahead and save that file. 127 00:08:27,950 --> 00:08:33,140 Everything should compile fine up to you if you want to test this out on a simulator. 128 00:08:33,590 --> 00:08:37,610 But Firebase works exactly as you expect on a simulator as well as on a device. 129 00:08:37,910 --> 00:08:42,800 So there are no issues between those classes of device as in virtual or real. 130 00:08:43,220 --> 00:08:45,530 OK, so that's Firebase totally integrated. 131 00:08:45,770 --> 00:08:47,750 We can actually get on with making our app now.