1
00:00:08,190 --> 00:00:11,390
Hey Hey everybody welcome to the next video.

2
00:00:11,430 --> 00:00:17,240
And in this video what we're going to do is we're going to set up firebase with our project firebase.

3
00:00:17,340 --> 00:00:19,850
As you might know is a really really cool.

4
00:00:19,890 --> 00:00:26,080
Real time back end server that's going to let us do authentication is going to let us log in users.

5
00:00:26,190 --> 00:00:32,440
It's going to let Us store things in our database like chat messages and different types of information.

6
00:00:32,460 --> 00:00:39,180
So let's go ahead and get started creating a firebase project and downloading it into our X code project.

7
00:00:39,180 --> 00:00:44,790
So go ahead and open up a Safari window and you're actually going to want to go to firebase dot Google

8
00:00:44,790 --> 00:00:45,630
dot com.

9
00:00:45,870 --> 00:00:50,490
This is the site you'll see and you're going to need to log into your Google account like I did and

10
00:00:50,490 --> 00:00:54,250
then click go to console and when you do that you'll see this window.

11
00:00:54,270 --> 00:00:59,140
Now I have a bunch of other projects here from other courses and other things that I've done this break

12
00:00:59,150 --> 00:01:04,200
point project is from the one that I used when building my app the first time.

13
00:01:04,260 --> 00:01:07,980
But we're going to create a new one I'm going to show you all the way from the beginning to the end.

14
00:01:08,040 --> 00:01:10,610
So go ahead and click add project.

15
00:01:10,710 --> 00:01:11,850
Now we're going to give it a name.

16
00:01:11,850 --> 00:01:14,810
I'm going to call this break point.

17
00:01:14,880 --> 00:01:18,000
I already have one called Break point so let's just call this one breakpoint dev.

18
00:01:18,390 --> 00:01:23,590
Choose your country or region for me it's the United States and then click Create project.

19
00:01:23,670 --> 00:01:28,890
Now as this is loading basically what we're going to do is we're going to configure this so that firebase

20
00:01:28,890 --> 00:01:34,290
can talk to our application and we're basically going to sync them together using a P list file that

21
00:01:34,290 --> 00:01:38,670
we're going to generate but it's actually going to need some information from our X could project.

22
00:01:38,670 --> 00:01:42,890
So go ahead and pull that open and let's just keep it in the background.

23
00:01:43,000 --> 00:01:45,990
Now this is the firebase con. It's very cool.

24
00:01:46,020 --> 00:01:50,130
On the left you can see authentication database storage hosting cetera et cetera.

25
00:01:50,130 --> 00:01:54,120
There's lots of things you can do here and I really encourage you to go through and read more because

26
00:01:54,130 --> 00:01:57,990
there's a lot that firebase can do and for free too which is cool.

27
00:01:58,000 --> 00:02:02,550
There of course are limitations but free is a pretty good price for what it what you get.

28
00:02:02,550 --> 00:02:09,180
So let's go ahead and let's add this firebase project to our X code project to do that.

29
00:02:09,180 --> 00:02:13,520
Go ahead and click iOS and this is going to take us through the iOS QuickStart.

30
00:02:13,530 --> 00:02:19,440
Now it begins by telling us to register our app and it's asking for our bundle I.D. If you remember

31
00:02:19,440 --> 00:02:25,820
a few videos back I told you to now if you remember a few videos back I told you that you'd be needing

32
00:02:25,820 --> 00:02:29,480
your bundle I.D. And this is where you will use it haha.

33
00:02:29,660 --> 00:02:38,270
So open up X code and go to your project settings and find your bundle identifier that bundle ID copy

34
00:02:38,270 --> 00:02:40,980
it and then head back over to Safari.

35
00:02:41,000 --> 00:02:45,980
We're going to paste that in here and this basically gives firebase a way to communicate with your application.

36
00:02:45,980 --> 00:02:48,410
Now of course we can give the app a nickname.

37
00:02:48,410 --> 00:02:53,060
I'm just going to call it break point but it is completely optional and up to you.

38
00:02:53,060 --> 00:02:58,730
Once you've done that go ahead and click register app and then it's going to generate a configuration

39
00:02:58,730 --> 00:03:00,090
file for you to download.

40
00:03:00,110 --> 00:03:04,220
Now it gives you some great instructions here to drag it into your project and make sure that you add

41
00:03:04,220 --> 00:03:05,790
it to all of the targets.

42
00:03:05,810 --> 00:03:06,380
We'll do that.

43
00:03:06,380 --> 00:03:12,380
So go ahead and let's download that file and you'll see that it will download to my downloads.

44
00:03:12,380 --> 00:03:19,580
But the issue is that I have downloaded this before and it's basically renamed it to Google service

45
00:03:19,610 --> 00:03:24,860
info Doppie list so I'm going to actually put it on my desktop here and I'm going to just rename it

46
00:03:24,890 --> 00:03:30,530
Google service dash info so that I don't have that dash 2 at the end because otherwise my app won't

47
00:03:30,530 --> 00:03:31,570
know what to do with it.

48
00:03:31,810 --> 00:03:32,380
OK.

49
00:03:32,660 --> 00:03:34,290
So we have downloaded it.

50
00:03:34,280 --> 00:03:37,580
Now we just need to drag it into our X code project.

51
00:03:37,580 --> 00:03:39,210
So I'm going to switch over to that.

52
00:03:39,380 --> 00:03:43,320
And now all we need to do is simply drag and drop.

53
00:03:43,560 --> 00:03:44,640
OK.

54
00:03:44,750 --> 00:03:50,080
Just like firebase said make sure that you add it to the target appropriately and click Finish.

55
00:03:50,090 --> 00:03:54,780
Now if you look in here this contains all of the important information that we need.

56
00:03:54,860 --> 00:03:57,860
Like our project id or storage bucket.

57
00:03:58,070 --> 00:04:02,870
All this special information that we need including our database you are l there's a lot of good stuff

58
00:04:02,870 --> 00:04:04,990
in here that firebase just does for us.

59
00:04:05,060 --> 00:04:06,410
It's that easy.

60
00:04:06,500 --> 00:04:07,220
Very very cool.

61
00:04:07,250 --> 00:04:12,500
So now we're going to go ahead and install something called a cocoa pod and a cocoa pod is basically

62
00:04:12,560 --> 00:04:18,080
a really easy way for you to bring in third party code into your app and give it extra functionality

63
00:04:18,080 --> 00:04:22,270
and extra frameworks and libraries to work with firebase is one of those.

64
00:04:22,280 --> 00:04:27,900
So to do that we're going to go ahead and actually open up a terminal window just like so.

65
00:04:28,220 --> 00:04:30,720
And we're also going to find our project.

66
00:04:30,770 --> 00:04:32,870
OK so there's the breakpoint project.

67
00:04:33,020 --> 00:04:38,810
Now if we look at the firebase directions here it will it tells us we need to create a pod file using

68
00:04:38,810 --> 00:04:44,730
POD in it then we need to open our pod file and add pod firebase core.

69
00:04:44,840 --> 00:04:48,440
Then it says we need to save the file and run spot install.

70
00:04:48,650 --> 00:04:50,090
So that's what we're going to do.

71
00:04:50,120 --> 00:04:53,600
Go ahead and minimize that window minimize everything.

72
00:04:53,600 --> 00:04:59,320
And what we're going to do is we're going to change directories into our breakpoint project folder.

73
00:04:59,330 --> 00:05:04,280
So go ahead and type CD and then drag in your breakpoint project folder.

74
00:05:04,280 --> 00:05:07,630
That's that's what I like to do instead of having to type out all of this madness.

75
00:05:07,670 --> 00:05:11,490
I just like to type CD space and then drag the folder onto the terminal.

76
00:05:11,840 --> 00:05:12,090
OK.

77
00:05:12,110 --> 00:05:14,180
So after that go ahead and press enter.

78
00:05:14,180 --> 00:05:19,080
And now we have entered the break point project library or project folder rather.

79
00:05:19,400 --> 00:05:21,350
So what we're going to do.

80
00:05:21,350 --> 00:05:26,330
Like it's said was first to go ahead and type pod in it.

81
00:05:26,960 --> 00:05:32,870
When we press Enter you'll notice that it will initialize an empty pod file in our folder.

82
00:05:32,870 --> 00:05:33,900
Very cool.

83
00:05:34,160 --> 00:05:38,630
If you get an error that means that you have not yet installed cocoa pods and so in order to do that

84
00:05:38,630 --> 00:05:40,930
you need to type sudo gem.

85
00:05:41,570 --> 00:05:45,130
Gem install cocoa pots.

86
00:05:45,170 --> 00:05:46,730
Press Enter let it do its thing.

87
00:05:46,730 --> 00:05:50,550
Enter your password and you'll have crockpots very easy.

88
00:05:50,940 --> 00:05:55,570
But assuming you already have cocoa pods installed you need to start by typing pod in it.

89
00:05:55,640 --> 00:05:57,530
And now we have a POD file.

90
00:05:57,650 --> 00:06:02,320
So go ahead and right click on the pod file and we're going to open it with Adam.

91
00:06:02,330 --> 00:06:05,140
This is a text editor that I really like to use.

92
00:06:05,330 --> 00:06:10,460
I advise against using text at it and I'll tell you that later in another section of this course but

93
00:06:10,720 --> 00:06:15,410
on text that it sometimes has problems with formatting so I like to use ADOM and it's totally free and

94
00:06:15,410 --> 00:06:16,320
available online.

95
00:06:16,340 --> 00:06:21,720
So open Adam and it's going to show us our pod file.

96
00:06:22,380 --> 00:06:24,420
Ok this is what it looks like.

97
00:06:24,420 --> 00:06:28,650
And you'll notice down here it says pods for breakpoint.

98
00:06:28,780 --> 00:06:34,310
OK this is where we are going to add the pods and let's go look back at safari to see what firebase

99
00:06:34,310 --> 00:06:35,400
asked us to do.

100
00:06:35,780 --> 00:06:40,090
It told us to add pod firebase core case.

101
00:06:40,100 --> 00:06:42,710
That is where we are going to.

102
00:06:43,070 --> 00:06:44,510
That's what we're going to put here.

103
00:06:44,810 --> 00:06:49,270
So to do that type pod firebase slash core.

104
00:06:49,370 --> 00:06:49,840
But you know what.

105
00:06:49,850 --> 00:06:52,280
That's actually not going to be enough for what we need to do.

106
00:06:52,280 --> 00:06:57,020
So we're also going to include authentication and database so to do that.

107
00:06:57,020 --> 00:07:06,610
Go ahead and type pod firebase slash database and POD firebase slash off OK.

108
00:07:06,740 --> 00:07:11,450
And that's going to give us authentication capabilities as well as the ability to access the database

109
00:07:12,020 --> 00:07:14,230
firebase core doesn't come with that by standard.

110
00:07:14,250 --> 00:07:20,930
So once you have added those three cocoa pods go ahead and save and close out of them.

111
00:07:21,050 --> 00:07:27,080
Quit it and then the last step is just to run Podd install that's going to go ahead and create an X-Sea

112
00:07:27,080 --> 00:07:30,170
workspace for us and it'll let us use firebase on our app.

113
00:07:30,170 --> 00:07:31,700
Really really cool.

114
00:07:31,700 --> 00:07:35,730
So let's go ahead and head back into the terminal window.

115
00:07:36,140 --> 00:07:41,720
And I want to show you what happens in the Finder when we run pod install.

116
00:07:42,400 --> 00:07:43,010
OK.

117
00:07:43,400 --> 00:07:46,890
Once you've typed that press enter and you'll notice it'll start to download.

118
00:07:46,910 --> 00:07:49,140
All of these tools now.

119
00:07:49,160 --> 00:07:56,120
These ones were not actually all of these and analytics we didn't include those in our pod file but

120
00:07:56,120 --> 00:08:01,580
they are kind of extra extensions that are required by them so it automatically downloads them for us

121
00:08:01,580 --> 00:08:03,240
which is pretty cool actually.

122
00:08:03,630 --> 00:08:04,000
OK.

123
00:08:04,070 --> 00:08:10,550
So now that we've installed are pods we have an X C workspace from now on in the course do not open

124
00:08:10,550 --> 00:08:13,810
your X could project only open the white and blue.

125
00:08:14,060 --> 00:08:17,690
Sorry the mostly white X-C workspace icon.

126
00:08:17,690 --> 00:08:20,690
That's what we got to open if we want to use our cocoa pots.

127
00:08:20,690 --> 00:08:21,280
All right cool.

128
00:08:21,280 --> 00:08:26,690
So now that that's done close the terminal window and you know what I think our ex-coach project is

129
00:08:26,690 --> 00:08:27,660
still open.

130
00:08:27,680 --> 00:08:31,540
So I'm actually going to close it and then reopen it using X-C workspace.

131
00:08:31,540 --> 00:08:35,120
So double click and let's see what we have.

132
00:08:36,580 --> 00:08:37,540
OK very cool.

133
00:08:37,540 --> 00:08:43,210
We have break breakpoint the application and we have a POD project that contains all of the cocoa pods

134
00:08:43,210 --> 00:08:44,620
that we just installed.

135
00:08:44,620 --> 00:08:50,760
So let's go ahead and let's set up our project so that we can actually communicate from our ex-cult

136
00:08:50,770 --> 00:08:55,420
project to firebase because right now we have linked firebase to our project.

137
00:08:55,420 --> 00:08:55,720
Right.

138
00:08:55,720 --> 00:09:00,180
We have set it up so that the cocoa pod is installed.

139
00:09:00,190 --> 00:09:04,800
We've downloaded the configuration file but now we need to enable the execute project to talk back up

140
00:09:04,840 --> 00:09:07,630
to the firebase project online.

141
00:09:07,810 --> 00:09:12,100
To do that we need to add some initialization code in our app delegate.

142
00:09:12,250 --> 00:09:12,890
OK.

143
00:09:13,060 --> 00:09:14,120
Really really easy.

144
00:09:14,140 --> 00:09:18,550
We just need to go into app delegate that swift and type firebase app doc configure.

145
00:09:18,580 --> 00:09:19,960
It's that easy.

146
00:09:20,020 --> 00:09:25,240
So do that now by opening app delegate then right here in.

147
00:09:25,240 --> 00:09:28,640
Did finish launching with options before we returned TRUE.

148
00:09:28,750 --> 00:09:34,060
We're going to go ahead and type Oh sorry first this is an important thing when you're using a cocoa

149
00:09:34,060 --> 00:09:38,980
pod if you want access to it you need to import it just like you would import any other framework on

150
00:09:38,980 --> 00:09:42,160
iOS So we're going to import firebase.

151
00:09:42,160 --> 00:09:50,350
And now we can go ahead and access firebase app that configure just like it said online and you know

152
00:09:50,350 --> 00:09:52,700
what boom we're done.

153
00:09:52,720 --> 00:09:54,050
We are connected.

154
00:09:54,070 --> 00:09:56,110
We can access everything from firebase.

155
00:09:56,120 --> 00:10:01,990
Now we haven't yet written the code to do that but we are now at this point totally connected.

156
00:10:01,990 --> 00:10:05,240
Let's go ahead and build the project by doing a command B.

157
00:10:05,410 --> 00:10:08,560
Make sure everything loads and everything is good to go.

158
00:10:09,010 --> 00:10:09,940
Let's see.

159
00:10:09,940 --> 00:10:10,760
Are we good.

160
00:10:11,880 --> 00:10:14,190
Boom build succeeded we are good to go.

161
00:10:14,190 --> 00:10:19,920
So our project is now successfully connected to firebase and we're good to start setting up our data

162
00:10:19,920 --> 00:10:24,780
service to start pushing information to our server on firebase so exciting.

163
00:10:24,780 --> 00:10:28,560
Let's go ahead and move over to the next video and let's get started with that right now.

