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