1
00:00:08,180 --> 00:00:13,370
Hey everybody this is Caleb with Dev slopes and in this video we're going to actually start searching

2
00:00:13,370 --> 00:00:16,760
for users based on their email from our data service.

3
00:00:16,760 --> 00:00:18,400
It's going to be so cool.

4
00:00:18,410 --> 00:00:22,500
This is my favorite part of the app getting to search for users and add them to groups.

5
00:00:22,520 --> 00:00:27,320
So let's go ahead and let's pull open our X code project and we're actually going to begin by going

6
00:00:27,320 --> 00:00:33,710
into the data service because that is where we're going to write our function to get an email returned

7
00:00:33,710 --> 00:00:39,800
back to us for a search query that we pass in from our textfield.

8
00:00:39,800 --> 00:00:44,490
So let's go into our data service and we're going to add a function.

9
00:00:44,510 --> 00:00:48,060
Let's let's put it down here at the very bottom.

10
00:00:48,500 --> 00:00:51,410
We're going to call it phunk get e-mail.

11
00:00:51,440 --> 00:00:57,160
Meaning that's what we want to get back for search query.

12
00:00:57,890 --> 00:00:58,580
OK.

13
00:00:58,880 --> 00:01:03,830
We're going to pass in a search query of type string and you know what let's actually go ahead and give

14
00:01:03,830 --> 00:01:06,460
it an internal parameter here of query.

15
00:01:06,830 --> 00:01:11,710
And what we want is for it to return an array of all of the potential emails.

16
00:01:11,720 --> 00:01:17,880
Let's say that we searched C-A maybe we would have Carl Cayla.

17
00:01:17,930 --> 00:01:23,600
That's not an alphabetical order but Karl Cayla you know it would show all of the CAA starting emails.

18
00:01:23,990 --> 00:01:28,760
So we need an array returned back to us of all of the potential options.

19
00:01:28,910 --> 00:01:34,100
So to do that since we're dealing with firebase we're going to need to use a completion handler that

20
00:01:34,100 --> 00:01:35,540
is escaping.

21
00:01:35,570 --> 00:01:40,520
So it's an escaping closure that lets the values escape out of the closure and we can pass it back to

22
00:01:40,520 --> 00:01:41,150
this function.

23
00:01:41,150 --> 00:01:43,730
So let's go ahead and create a handler.

24
00:01:44,060 --> 00:01:47,300
And of course like I said it's escaping.

25
00:01:47,660 --> 00:01:52,400
Now we've done this like 100 times in this course and we'll do it a few more times but we're basically

26
00:01:53,090 --> 00:01:59,020
creating a function that we can pass values into and we're not returning anything to this.

27
00:01:59,150 --> 00:02:04,790
We're not returning anything to this function explicitly but we do have access to it whenever we call

28
00:02:04,790 --> 00:02:06,150
it from somewhere else.

29
00:02:06,170 --> 00:02:10,920
So like I said we're going to need an e-mail array.

30
00:02:11,090 --> 00:02:13,460
So this is going to be an array of type string.

31
00:02:13,460 --> 00:02:19,220
Ok lots of strings lots of e-mails and we're not returning anything to this function but this function

32
00:02:19,220 --> 00:02:22,010
will be available to us wherever we call it.

33
00:02:22,430 --> 00:02:25,320
OK go ahead and give it some curly brackets.

34
00:02:25,560 --> 00:02:29,380
And I want you to notice here in the GET ALL feed messages function.

35
00:02:29,480 --> 00:02:35,410
We created an array of message at the very beginning then at the very end after we had filled it we

36
00:02:35,410 --> 00:02:37,380
had handed that back to our handler.

37
00:02:37,580 --> 00:02:39,710
We're going to do a very similar thing here.

38
00:02:39,730 --> 00:02:45,170
So I'm going to go ahead and create an e-mail array similar or actually exactly like what we need to

39
00:02:45,170 --> 00:02:46,140
return at the end.

40
00:02:46,160 --> 00:02:52,550
So go ahead and type var e-mail array and it's going to be an email of type string and we're going to

41
00:02:52,550 --> 00:02:54,320
instantiate it.

42
00:02:54,350 --> 00:02:59,270
Now we're going to go ahead and look through our users reference and we're going to write a for loop

43
00:02:59,270 --> 00:03:04,100
that's going to search through all of them and return the ones that match our search query.

44
00:03:04,100 --> 00:03:10,310
So go ahead and call ref users and we're going to go ahead and observe every user.

45
00:03:10,310 --> 00:03:14,040
So we're going to observe the whole reference and we're going to watch for values.

46
00:03:14,060 --> 00:03:19,790
Now if you've never used firebase before I probably should have explained this but value means any data

47
00:03:19,790 --> 00:03:26,250
changes at a location like our users reference or recursively at any child node.

48
00:03:26,300 --> 00:03:31,190
So we're not going into a child here specifically not a specific user yet.

49
00:03:31,190 --> 00:03:36,320
We're just looking at the entire reference for all of its values and we're going to go ahead and get

50
00:03:36,320 --> 00:03:42,720
a snapshot bakso press enter and I'm going to call this user snapshot.

51
00:03:43,460 --> 00:03:44,050
OK.

52
00:03:44,210 --> 00:03:52,100
So now that we are observing the user snapshot we're going to go ahead and we're going to create an

53
00:03:52,190 --> 00:03:56,420
instance of user snapshot and then we're going to loop through it like with a for loop.

54
00:03:56,420 --> 00:04:04,490
So go ahead and type guard let users snapshot equals user snapshot which is the one we passed in here

55
00:04:05,290 --> 00:04:06,310
children.

56
00:04:06,350 --> 00:04:10,810
All objects we're going to cast this as an array of data snapshot.

57
00:04:10,850 --> 00:04:16,160
Moving quickly because we've done this before else meaning if we can't do that we're going to go ahead

58
00:04:16,160 --> 00:04:19,270
and just return and get out of this function.

59
00:04:19,280 --> 00:04:24,140
All righty so assuming everything is good to go we get some users back.

60
00:04:24,140 --> 00:04:29,840
We're going to go ahead and look at that user snapshot and we're going to go ahead and type for user

61
00:04:30,870 --> 00:04:32,580
and user snapshot.

62
00:04:32,600 --> 00:04:38,480
Now we're going to loop through every single user and we need to actually take the user and pull out

63
00:04:38,480 --> 00:04:39,470
their e-mail.

64
00:04:39,530 --> 00:04:45,950
If you remember in our firebase array we have a bunch of users here and each user has a unique ID an

65
00:04:45,980 --> 00:04:47,620
e-mail and a provider.

66
00:04:47,690 --> 00:04:50,540
We're going to pull out the e-mail and save it into a constant.

67
00:04:50,570 --> 00:04:55,580
So go ahead and type let e-mail equal user OK so we.

68
00:04:55,730 --> 00:05:01,280
We cycle through we start appear at the very tippy top with this guy maybe it's not going to open up

69
00:05:01,400 --> 00:05:02,810
interesting let me refresh.

70
00:05:02,810 --> 00:05:07,310
Looks like it's a little sleepy sleepy base.

71
00:05:07,310 --> 00:05:07,710
There we go.

72
00:05:07,730 --> 00:05:08,200
OK.

73
00:05:08,450 --> 00:05:13,310
So if we open up this user we can cycle through and we can pull out his e-mail.

74
00:05:13,310 --> 00:05:17,180
So the key is e-mail and the value is Marty.

75
00:05:17,180 --> 00:05:19,130
Great Scott dotcom.

76
00:05:19,400 --> 00:05:22,920
So go ahead and type user child snapshot.

77
00:05:23,060 --> 00:05:26,870
And of course the child that we want is called e-mail.

78
00:05:27,140 --> 00:05:32,360
Now we don't want that though we want the values that we're going to type value and we're going to cast

79
00:05:32,360 --> 00:05:38,110
that we're going to force cast that as a string because it comes in as a value of any.

80
00:05:38,120 --> 00:05:40,820
So we're going to go ahead and forecast it to be a string.

81
00:05:41,270 --> 00:05:44,140
So we now have the e-mail of the user.

82
00:05:44,330 --> 00:05:49,880
And now this is where we're going to check to see if the queery let's say we passed in CA we're going

83
00:05:49,880 --> 00:05:52,910
to see if the e-mail contains that in any way.

84
00:05:53,000 --> 00:05:56,240
So we're going to go ahead and type if e-mail.

85
00:05:56,300 --> 00:05:58,280
And here's a really cool thing we can do.

86
00:05:58,280 --> 00:06:05,840
There's a function for strings that we can type called Dot contains and we can check to see if this

87
00:06:05,840 --> 00:06:07,910
string contains another string.

88
00:06:07,910 --> 00:06:13,040
So if CA is a part of this string then we can check to see if it's there.

89
00:06:13,040 --> 00:06:18,590
So check it out if email contains queery what we searched.

90
00:06:19,000 --> 00:06:19,450
OK.

91
00:06:19,460 --> 00:06:25,250
If that's true because sorry if you look you can see that this returns a boolean So we need to check

92
00:06:25,670 --> 00:06:34,010
if email contains queery is true then we're going to go ahead and type e-mail array and we're going

93
00:06:34,010 --> 00:06:36,200
to append the e-mail.

94
00:06:36,520 --> 00:06:38,160
OK the e-mail that we returned.

95
00:06:38,300 --> 00:06:41,030
The e-mail that we pulled out of our users snapshot.

96
00:06:41,030 --> 00:06:42,040
Easy as that.

97
00:06:42,320 --> 00:06:48,830
But what if we cycle through and for instance the account that I'm logged into right now is Harvey Dent

98
00:06:48,830 --> 00:06:53,610
dot com which is one of these what if I cycled through and found myself ok.

99
00:06:53,640 --> 00:07:00,050
I don't I shouldn't be able to add myself manually to a group I should automatically join a group or

100
00:07:00,050 --> 00:07:01,970
I shouldn't be able to appear in the search results.

101
00:07:01,970 --> 00:07:04,940
What I'm saying I shouldn't have to add myself to a group manually.

102
00:07:05,180 --> 00:07:07,890
So I'm going to also check to see.

103
00:07:08,510 --> 00:07:17,000
And so if the e-mail contains the query and the e-mail is not equal to my own e-mail and you know how

104
00:07:17,000 --> 00:07:20,050
we're going to check that we're going to use firebase surprise surprise.

105
00:07:20,060 --> 00:07:25,250
We're going to go ahead and call off our current user e-mail.

106
00:07:25,250 --> 00:07:25,950
All righty.

107
00:07:26,210 --> 00:07:35,930
So if and only if the e-mail contains the query and the e-mail is not my e-mail then we're good to go.

108
00:07:35,990 --> 00:07:41,100
Now it's yelling at us oh and it's asking that we optional unwrap the current user.

109
00:07:41,300 --> 00:07:42,380
That's fine.

110
00:07:42,380 --> 00:07:48,800
So this is a way that we can search through and we can create an array of all the e-mails that match

111
00:07:48,860 --> 00:07:52,270
a certain search query at the very end of this for loop.

112
00:07:52,310 --> 00:07:56,230
We're going to go ahead and we're going to return or not return sorry.

113
00:07:56,660 --> 00:07:58,860
We're going to use the completion handler.

114
00:07:58,880 --> 00:08:04,430
So go ahead and type handler and if you look you'll see it's asking for an array of type String.

115
00:08:04,430 --> 00:08:07,220
We have one that's called e-mail array.

116
00:08:07,310 --> 00:08:08,210
Very cool.

117
00:08:08,210 --> 00:08:10,570
So that's going to go ahead and fill up our array.

118
00:08:10,610 --> 00:08:16,400
We can return it here to our handler and now wherever we call this we can get an e-mail array for all

119
00:08:16,400 --> 00:08:19,610
of our users from firebase for the search query that we pass in.

120
00:08:19,610 --> 00:08:20,540
It's very very cool.

121
00:08:20,540 --> 00:08:27,260
So what we're going to do is we're going to go head and head into create groups Visi already and we're

122
00:08:27,260 --> 00:08:29,770
going to go set up how we can use this.

123
00:08:29,780 --> 00:08:35,990
So let's think what we're doing right now is we are just showing static cells and we'll fix that in

124
00:08:35,990 --> 00:08:36,910
just a second.

125
00:08:37,190 --> 00:08:44,840
But for now what we're going to do is we're going to set up our email search textfield to basically

126
00:08:44,840 --> 00:08:47,570
have some way of knowing when we are typing.

127
00:08:47,570 --> 00:08:53,390
Because if I type C it should search that query and find all the e-mails starting with see if I type

128
00:08:53,390 --> 00:08:57,320
C.A. it should update and then show all the text fields starting with CA.

129
00:08:57,350 --> 00:09:03,730
So we need a way to identify and basically utilize the power of these text fields.

130
00:09:03,740 --> 00:09:07,570
And so in order to do that we're going to go ahead and conform to you.

131
00:09:07,580 --> 00:09:10,750
Textfield delegate and let's do that down here.

132
00:09:10,940 --> 00:09:18,640
Let's type extension create groups AVC and UI textfield delegate.

133
00:09:19,180 --> 00:09:19,880
OK.

134
00:09:20,180 --> 00:09:25,910
Now you'll probably notice that if I build and run we're good to go there will be no errors from this

135
00:09:25,910 --> 00:09:28,110
because there are no required delegate methods.

136
00:09:28,160 --> 00:09:35,000
But we we can definitely use them to give us the ability to monitor what's going on in the email search

137
00:09:35,010 --> 00:09:40,610
textfield So now that we've conformed to that we can go ahead and type email search textfield delegate

138
00:09:41,190 --> 00:09:42,740
is going to be equal to self.

139
00:09:42,890 --> 00:09:43,190
OK.

140
00:09:43,190 --> 00:09:48,790
Now this gives us the ability to control and interact with our textfield the way that we want to.

141
00:09:49,040 --> 00:09:54,020
And the coolest thing is we can set something up that will basically observe and monitor whenever we

142
00:09:54,020 --> 00:09:58,430
type anything on the keyboard if we type a letter if we delete something it's going to go ahead and

143
00:09:58,430 --> 00:10:01,300
call a notification every single time that happens.

144
00:10:01,400 --> 00:10:02,900
And here's how we're going to do it.

145
00:10:02,930 --> 00:10:09,410
We're going to call email search textfield and we're going to use what's called an target K and add

146
00:10:09,410 --> 00:10:15,830
target basically allows you to add a target a selector and a control event.

147
00:10:15,920 --> 00:10:16,440
OK.

148
00:10:16,610 --> 00:10:18,400
Now the target of course is self.

149
00:10:18,410 --> 00:10:21,410
It's the UI textfield itself the selector.

150
00:10:21,410 --> 00:10:26,500
This works just like a tap gesture recognizer or you swipe gesture recognizer.

151
00:10:26,540 --> 00:10:32,510
We're basically going to call Pound's selector and then whatever goes in here whatever function goes

152
00:10:32,510 --> 00:10:37,300
in here will be called for a certain UI control event.

153
00:10:37,340 --> 00:10:39,010
And there are tons of them check this out.

154
00:10:39,020 --> 00:10:43,830
If I put a period here you can have it be called on any editing event.

155
00:10:43,880 --> 00:10:47,150
All events all touch events editing change editing began.

156
00:10:47,150 --> 00:10:48,620
Touch cancel touch drag.

157
00:10:48,620 --> 00:10:49,840
There's tons of them.

158
00:10:50,030 --> 00:10:54,910
But we're going to use editing changed because we want to know are letters being added.

159
00:10:54,910 --> 00:10:56,990
Are they being removed et cetera et cetera.

160
00:10:57,290 --> 00:10:59,030
So that is what we're going to do.

161
00:10:59,030 --> 00:11:03,320
The target we're talking about is editing change that's how we're going to monitor what is happening

162
00:11:03,590 --> 00:11:04,960
in this textfield.

163
00:11:05,090 --> 00:11:11,090
Now we do need to write a function that will be called every time that the editing is changed and we're

164
00:11:11,090 --> 00:11:14,240
going to write that right here by bloviated load.

165
00:11:14,240 --> 00:11:19,810
So go ahead and write phunk text field did change.

166
00:11:20,180 --> 00:11:22,470
And this is going to be our own function.

167
00:11:22,470 --> 00:11:26,780
Now in this textfield we have two things that we need to think about.

168
00:11:26,930 --> 00:11:31,360
Obviously when we're typing text it should be searching and updating an email array.

169
00:11:31,670 --> 00:11:38,270
And if we delete everything back down to nothing if we remove all the characters it should clear the

170
00:11:38,270 --> 00:11:40,340
array and it should reload the table.

171
00:11:40,430 --> 00:11:41,040
The table view.

172
00:11:41,030 --> 00:11:42,470
So there are no cells.

173
00:11:42,500 --> 00:11:45,330
So we're going to basically check to see if it's empty.

174
00:11:45,410 --> 00:11:49,850
It's going to empty the array and it's going to reload the table view if it's not empty it's going to

175
00:11:49,850 --> 00:11:52,990
do the search and we're going to fill an array in this view controller.

176
00:11:53,000 --> 00:12:00,230
So we're going to start by typing if email textfield text is equal to an empty string meaning if there

177
00:12:00,230 --> 00:12:08,750
is nothing in the text field we're going to go ahead and just reload the table view table what is it

178
00:12:08,750 --> 00:12:10,150
called oh.

179
00:12:10,220 --> 00:12:10,820
Table View.

180
00:12:10,910 --> 00:12:11,370
OK.

181
00:12:11,420 --> 00:12:13,280
Table View reload data.

182
00:12:13,280 --> 00:12:13,930
Awesome.

183
00:12:14,030 --> 00:12:19,430
But what if there is still data that is accessible to this table view it's not going to clear it out.

184
00:12:19,460 --> 00:12:25,190
So we actually need to create an array that our table is going to pull from and we're going to do that

185
00:12:25,190 --> 00:12:29,480
very similarly to how we've done this in view controllers in this app in the past.

186
00:12:29,480 --> 00:12:34,710
We're going to create an array in this view controller and we will fill it up later when we call it

187
00:12:34,730 --> 00:12:35,950
email for search queries.

188
00:12:35,960 --> 00:12:43,660
So go ahead and type var e-mail array and this is of course going to be an e-mail array of type string

189
00:12:44,270 --> 00:12:47,070
and we're going to instantiate it from the beginning.

190
00:12:47,360 --> 00:12:48,550
So that's good.

191
00:12:48,710 --> 00:12:53,660
And now we're going to go ahead and we're going to just say if the search field is empty We're going

192
00:12:53,660 --> 00:13:00,230
to make sure that the e-mail array whoopsies e-mail array is also empty because then when the table

193
00:13:00,230 --> 00:13:02,710
view reloads there will be nothing displayed in the table view.

194
00:13:02,810 --> 00:13:09,680
But what if there is something in the text field so else if there is something in the text field what

195
00:13:09,680 --> 00:13:20,230
we should do is call data service instance dot whereas our function here to get email for search query.

196
00:13:20,240 --> 00:13:22,450
Now where's that search query coming from.

197
00:13:22,450 --> 00:13:23,560
Our textfield.

198
00:13:23,690 --> 00:13:32,210
So let's go ahead and let's call e-mail search textfield text and we need to unwrap it forcefully by

199
00:13:32,210 --> 00:13:33,340
the way.

200
00:13:33,410 --> 00:13:36,400
It'll give us an error if we don't.

201
00:13:36,680 --> 00:13:41,450
And that's how we're going to pass in our search queries so every time that it's edited we're going

202
00:13:41,450 --> 00:13:43,340
to go ahead and pass in whatever it says.

203
00:13:43,350 --> 00:13:48,060
So if I type a c it's going to search for all the e-mails and update the table view if I type C.A. it'll

204
00:13:48,060 --> 00:13:50,360
update it again and show that all the current emails.

205
00:13:50,390 --> 00:13:52,900
Very very cool and totally realtime.

206
00:13:52,940 --> 00:13:58,250
So this is where we're going to use our handler to return our e-mail array and fill up the one in this

207
00:13:58,250 --> 00:13:58,810
view controller.

208
00:13:58,810 --> 00:14:00,440
So go ahead and press enter.

209
00:14:00,590 --> 00:14:08,960
We'll call this e-mail array and we can basically set it up to be like this self e-mail IRA meaning

210
00:14:08,960 --> 00:14:16,400
the one that we have in this view controller is going to be equal to e-mail array meaning the one that

211
00:14:16,400 --> 00:14:24,030
we get returned Let's call this return e-mail or just for specificity returned e-mail or right.

212
00:14:24,320 --> 00:14:25,330
Awesome.

213
00:14:25,340 --> 00:14:28,660
And once those e-mails come in we should call self.

214
00:14:28,760 --> 00:14:30,310
Table View Dattilo data.

215
00:14:30,320 --> 00:14:32,850
So it can show the new search.

216
00:14:32,870 --> 00:14:37,130
Now of course this function is going to do nothing unless we call it from our selector.

217
00:14:37,130 --> 00:14:42,130
So let's go ahead and call textfield did change but watch what happens when I try to build it.

218
00:14:42,380 --> 00:14:47,510
If you've ever used you I tap gesture recognizers you know that you need to expose the function to Objective-C

219
00:14:48,080 --> 00:14:52,430
and so we can do that by simply clicking fix or typing at O.B. Jaycee.

220
00:14:52,490 --> 00:14:55,520
So I don't know about you but I want to go test this out.

221
00:14:55,520 --> 00:15:03,110
There's only one thing we need to do to actually make this work and that is to set up our table view

222
00:15:03,110 --> 00:15:09,050
to actually pull from the e-mail right now of course returning 3 is great but we might have more users

223
00:15:09,050 --> 00:15:12,190
than that so let's go and pull it from e-mail.

224
00:15:12,260 --> 00:15:17,660
Because those will get downloaded and we're going to just take the count of the e-mail right now to

225
00:15:17,660 --> 00:15:19,240
get each user's e-mail.

226
00:15:19,250 --> 00:15:25,340
We're going to go ahead and we're going to use the index path of the table view to pull out the right

227
00:15:25,360 --> 00:15:28,290
e-mail from our e-mail right at the right time.

228
00:15:28,310 --> 00:15:36,030
So for every e-mail we can go ahead and just type email right and we can pass it the index path daro.

229
00:15:36,290 --> 00:15:40,850
That way if we have the first cell it's going to pull out the first user from the e-mail array and pass

230
00:15:40,850 --> 00:15:42,960
that in as the proper cell.

231
00:15:42,980 --> 00:15:47,160
Now later we're going to set up the selection status but not right now.

232
00:15:47,180 --> 00:15:52,100
Let's go ahead and build and run this let's go see if our search function works properly.

233
00:15:52,130 --> 00:15:54,090
Let's go see how we did.

234
00:15:54,170 --> 00:15:54,500
All right.

235
00:15:54,500 --> 00:15:56,930
So here we go.

236
00:15:57,020 --> 00:15:59,860
Let's pull open our simulator here.

237
00:15:59,990 --> 00:16:01,190
Firebase for now.

238
00:16:01,370 --> 00:16:01,610
OK.

239
00:16:01,610 --> 00:16:06,160
So go into groups and if we pull it up there's nothing so we shouldn't see any cells.

240
00:16:06,170 --> 00:16:10,080
But as soon as I open it up let me type A C.

241
00:16:10,200 --> 00:16:11,050
Ok cool.

242
00:16:11,270 --> 00:16:14,690
All of these users have sees of course because there is dot.com.

243
00:16:14,720 --> 00:16:18,230
How about let's just search for Evan so Evy.

244
00:16:18,410 --> 00:16:21,210
OK dev slopes of slopes but how about Evan himself.

245
00:16:21,210 --> 00:16:22,090
Awesome.

246
00:16:22,470 --> 00:16:27,480
So Evan shows up singularly And if I erase it updates the search every single time.

247
00:16:27,480 --> 00:16:34,030
So Mark Marty and Mark both show up because they start with a R and Marty only shows up.

248
00:16:34,140 --> 00:16:35,270
That is so cool.

249
00:16:35,490 --> 00:16:37,920
OK so our search is working beautifully.

250
00:16:37,920 --> 00:16:43,680
We can now search through all of our users and oh let's let's see what user we're logged into on this

251
00:16:43,680 --> 00:16:43,980
account.

252
00:16:43,980 --> 00:16:45,690
Let's double check.

253
00:16:45,990 --> 00:16:50,160
I have not yet set up the dismiss function.

254
00:16:50,160 --> 00:16:55,190
Looks like we have it here actually in our view controller file and we go back and set that.

255
00:16:55,350 --> 00:16:56,230
My mistake.

256
00:16:59,420 --> 00:17:04,260
OK so close button was pressed is supposed to dismiss the view controller.

257
00:17:04,710 --> 00:17:07,800
So go ahead and type that dismiss.

258
00:17:07,800 --> 00:17:08,750
Animated is true.

259
00:17:08,760 --> 00:17:09,770
Completion is nil.

260
00:17:09,790 --> 00:17:13,770
Now Dunbarton we're going to save that later we have a function to create a group and to save it up

261
00:17:13,770 --> 00:17:16,840
and firebase but we're not going to use that yet.

262
00:17:16,860 --> 00:17:21,180
So for now we're going to go ahead and check to see what user We're signed in as and we're going to

263
00:17:21,180 --> 00:17:25,980
try to search for ourself because remember we shouldn't be able to find ourselves where say we're logged

264
00:17:25,980 --> 00:17:26,750
in as Batman.

265
00:17:26,770 --> 00:17:29,900
Gotham dot net so let's go search for us.

266
00:17:30,000 --> 00:17:32,370
Let's see the Bat Man.

267
00:17:32,370 --> 00:17:32,940
OK good.

268
00:17:32,970 --> 00:17:37,290
So we can't find ourselves because that's our user that we're trying to create the group from when we

269
00:17:37,290 --> 00:17:40,230
click done later we're going to add ourselves into the group.

270
00:17:40,230 --> 00:17:44,690
But for now when we create a group it's only going to show us the accounts that we search for.

271
00:17:44,700 --> 00:17:47,030
Super super cool guys this is amazing.

272
00:17:47,070 --> 00:17:53,820
In the next video we're going to set up our table view cell so that when we tap add group when we search

273
00:17:53,820 --> 00:17:58,710
for an e-mail and we select them we're going to set it so that the check mark shows it's going to be

274
00:17:58,710 --> 00:17:59,900
hidden by default.

275
00:18:00,120 --> 00:18:04,570
Then what we're going to do is we're going to set it so that when we select a person their email is

276
00:18:04,560 --> 00:18:06,560
going to be added to this label.

277
00:18:06,660 --> 00:18:12,450
And so we can search back we can go find another person at Marty at Harvey ad Chuck and they will all

278
00:18:12,450 --> 00:18:14,140
show up in the array.

279
00:18:14,190 --> 00:18:19,950
Then when we click done it's going to go ahead and it's going to create a group upload it to firebase

280
00:18:20,010 --> 00:18:24,770
and then that will be that we're going to start that in the next video it's going to be super cool.

281
00:18:24,870 --> 00:18:26,820
Again guys this is one of my favorite view controllers.

282
00:18:26,820 --> 00:18:28,730
I think it's the coolest one in this app.

283
00:18:28,740 --> 00:18:33,600
So get excited we're going to head over to the next video and set that up now.

