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