1
00:00:07,430 --> 00:00:12,500
Hey everybody this is Caleb with deps slopes and in this video we're going to set up our table view

2
00:00:12,550 --> 00:00:17,160
cells when we add a group to show the checkmark when we tap on it.

3
00:00:17,200 --> 00:00:23,140
Hide the checkmark when we tap on it again and we're going to also be able to add those users that we

4
00:00:23,140 --> 00:00:27,910
select into their own array and then we'll pass that in to create a group in the next video.

5
00:00:27,910 --> 00:00:33,850
But for this one we're going to set up the table view cell to show and hide the checkmark as well as

6
00:00:33,850 --> 00:00:35,170
add the users to an array.

7
00:00:35,200 --> 00:00:41,950
So go ahead and open up your X code project and we're going to start in user cell now in and use your

8
00:00:41,950 --> 00:00:42,340
cell.

9
00:00:42,340 --> 00:00:48,740
There is a function called Set selected that allows us to configure the view for the selected state.

10
00:00:48,910 --> 00:00:51,950
So go ahead and get rid of that boilerplate code.

11
00:00:51,970 --> 00:00:53,920
And here's what we're going to do.

12
00:00:54,110 --> 00:01:00,280
In set selected We're going to basically use these selected boolean to determine whether or not the

13
00:01:00,280 --> 00:01:02,680
check image view is hidden or showing.

14
00:01:02,830 --> 00:01:06,330
So we can use if selected.

15
00:01:06,940 --> 00:01:18,320
Meaning if we've tapped on the cell check check image is hidden is hidden equals false meaning it's

16
00:01:18,320 --> 00:01:19,610
showing.

17
00:01:19,790 --> 00:01:28,190
Else meaning if it is not selected go ahead and type check image is hidden equals true already.

18
00:01:28,400 --> 00:01:34,940
So that's going to allow us to tap on the cell and show the check image as well as tap on the cell and

19
00:01:34,940 --> 00:01:35,360
hide it.

20
00:01:35,360 --> 00:01:36,710
So let's go and build and run.

21
00:01:36,710 --> 00:01:39,190
And let's just see if that worked.

22
00:01:39,500 --> 00:01:45,820
When we use our table view so it'll pull open our simulator here we're going to build a break point.

23
00:01:46,100 --> 00:01:51,950
Let's go into the group's Visi let's create a group and let's search for somebody.

24
00:01:51,950 --> 00:01:53,380
How about SI.

25
00:01:53,510 --> 00:01:54,070
OK.

26
00:01:54,110 --> 00:02:01,010
And if I tap the check shows up if I tap again it's well OK so it's still there.

27
00:02:01,010 --> 00:02:02,310
So that's not good.

28
00:02:02,390 --> 00:02:04,170
So that's not working.

29
00:02:04,190 --> 00:02:12,080
It appears that selected is a status that only works when a cell is actually tapped on.

30
00:02:12,080 --> 00:02:12,940
But you know what.

31
00:02:13,160 --> 00:02:18,380
What we should do is we should create a boolean that will flip flop and that will allow us to show and

32
00:02:18,380 --> 00:02:20,180
hide it at will.

33
00:02:20,180 --> 00:02:25,190
So let's go ahead and let's create a boolean called showing and let's set it to be equal to false by

34
00:02:25,190 --> 00:02:30,370
default just because all these cells are not showing by default until we select them.

35
00:02:30,680 --> 00:02:36,440
And let's go ahead and let's set showing to be used as kind of our boolean check to see whether or not

36
00:02:36,470 --> 00:02:38,060
the image view should actually be hidden.

37
00:02:38,060 --> 00:02:46,820
So if it's selected meaning if we tap on it and if showing is false We're going to go ahead and we're

38
00:02:46,820 --> 00:02:48,920
going to show the image view.

39
00:02:48,980 --> 00:02:49,760
Right.

40
00:02:49,880 --> 00:02:54,980
If it's selected if we tap on it and if showing is false meaning if it's not showing we're going to

41
00:02:54,980 --> 00:03:00,070
show it then we're going to set showing to be equal to true.

42
00:03:00,580 --> 00:03:00,880
OK.

43
00:03:00,890 --> 00:03:02,860
That's where we're going to get interesting here.

44
00:03:02,990 --> 00:03:04,500
So let's get rid of that.

45
00:03:04,520 --> 00:03:05,930
Let's go ahead and

46
00:03:09,180 --> 00:03:10,040
yes sorry.

47
00:03:10,080 --> 00:03:15,600
We've got to move this up because this is we're checking if it's showing we're going to go ahead or

48
00:03:15,600 --> 00:03:17,940
sorry if it's selected and it's not showing.

49
00:03:17,940 --> 00:03:22,320
We're going to show it then set showing the true meaning showing is now true.

50
00:03:22,320 --> 00:03:29,160
So if I tap on it again showing is true that means it will be selected but it will break down through

51
00:03:29,190 --> 00:03:30,060
here.

52
00:03:30,240 --> 00:03:35,280
Then check image that is hidden meaning it should hide.

53
00:03:35,280 --> 00:03:40,230
And that means we should also set set showing to be false.

54
00:03:40,230 --> 00:03:41,430
All right.

55
00:03:41,430 --> 00:03:44,840
It's pretty easy and it looks like we were missing a bracket.

56
00:03:44,830 --> 00:03:47,000
There let's go ahead and add it.

57
00:03:47,010 --> 00:03:49,110
We should have a bracket for there.

58
00:03:49,200 --> 00:03:51,390
Yep should have a bracket.

59
00:03:51,630 --> 00:03:52,720
OK everything's good.

60
00:03:53,010 --> 00:03:53,250
OK.

61
00:03:53,250 --> 00:03:57,270
So let's go ahead and build and run and let's see if that fixes our problem with selecting and showing

62
00:03:57,270 --> 00:04:02,140
and hiding the check image view having this little variable in here should be pretty helpful.

63
00:04:02,160 --> 00:04:04,770
So click groups click new.

64
00:04:04,800 --> 00:04:06,510
Let's search for someone.

65
00:04:06,840 --> 00:04:10,280
OK so everybody is selected so that's not good.

66
00:04:10,560 --> 00:04:15,600
Oh but you know what if we go back to create groups I believe that we passed in everybody is selected

67
00:04:15,600 --> 00:04:16,380
by default.

68
00:04:16,560 --> 00:04:17,000
Yes we did.

69
00:04:17,010 --> 00:04:17,210
OK.

70
00:04:17,220 --> 00:04:18,140
So that's why.

71
00:04:18,240 --> 00:04:22,110
So let's select somebody and unselect them select unselect.

72
00:04:22,140 --> 00:04:29,370
Ok cool so our variable is working it's going to let us monitor and set up the check status of some

73
00:04:29,370 --> 00:04:30,180
of these people.

74
00:04:30,330 --> 00:04:31,230
So that's awesome.

75
00:04:31,470 --> 00:04:32,040
That's great.

76
00:04:32,040 --> 00:04:33,660
Looks like that's taken care of.

77
00:04:33,720 --> 00:04:39,360
Now we just need to set up how we can configure these cells to know whether or not they are selected

78
00:04:39,390 --> 00:04:40,200
or not.

79
00:04:40,200 --> 00:04:43,560
So let's go ahead and let's dive into doing that.

80
00:04:43,560 --> 00:04:50,280
What we're going to actually use is we're going to use did select row index path to Table View function

81
00:04:50,700 --> 00:04:57,510
and this function is basically called whenever a table cell is selected right at a certain index path.

82
00:04:57,510 --> 00:05:04,000
So this cell for instance is selected at index path 1 right because we started 0 then 1 then 2.

83
00:05:04,200 --> 00:05:06,010
So this is a certain index path.

84
00:05:06,020 --> 00:05:12,600
This is a certain index path and we're going to use that to basically create a temporary array in this

85
00:05:12,600 --> 00:05:17,820
view controller for all the people we select because we obviously aren't going to want all these users

86
00:05:17,820 --> 00:05:23,340
in our array but we might want some of them so we can tap on one and add it to our RE tap on another

87
00:05:23,480 --> 00:05:24,740
add it to our right.

88
00:05:24,990 --> 00:05:34,170
So let's go up to the top and let's create that by typing var chosen user array.

89
00:05:34,440 --> 00:05:38,310
It's going to be of type string because it's just going to be email values.

90
00:05:38,310 --> 00:05:45,560
And this is going to be an array that will hold all the e-mails that we choose to let into that array.

91
00:05:45,570 --> 00:05:52,650
Now in order to actually use this in did select row it index path we're going to need to first create

92
00:05:52,650 --> 00:05:53,450
a cell.

93
00:05:53,580 --> 00:05:57,120
Right because we're going to need to pull the email from the cell.

94
00:05:57,150 --> 00:05:59,500
So let's go ahead and do that by typing.

95
00:05:59,520 --> 00:06:02,790
Guard let cell equals table view.

96
00:06:02,910 --> 00:06:06,160
Dequeue reuseable cell identifier we've done this before.

97
00:06:06,330 --> 00:06:12,530
And of course these cells here on this screen are user cells.

98
00:06:12,540 --> 00:06:18,300
Now we're going to need to force cast it as a user cell to actually create an instance of user's cell.

99
00:06:18,480 --> 00:06:21,210
And so assuming that does not work we're going to type.

100
00:06:21,200 --> 00:06:25,130
Else and we'll just return OK.

101
00:06:25,590 --> 00:06:28,360
I'd like to put a space on either side just for athletics.

102
00:06:28,440 --> 00:06:32,360
But anyway so this assumes we get a cell returned.

103
00:06:32,430 --> 00:06:35,040
Now we're only using this for the values inside.

104
00:06:35,070 --> 00:06:38,880
Meaning the text value of the e-mail label.

105
00:06:38,940 --> 00:06:43,830
So let's go ahead and let's just say that we open the app.

106
00:06:43,830 --> 00:06:48,690
All of these are unselected let me set them as unselected here so we see what it would sort of look

107
00:06:48,690 --> 00:06:49,550
like.

108
00:06:49,950 --> 00:06:50,240
OK.

109
00:06:50,250 --> 00:06:51,950
So nothing is selected.

110
00:06:52,020 --> 00:06:54,840
I select a user it becomes checked.

111
00:06:54,840 --> 00:06:55,580
That's great.

112
00:06:55,710 --> 00:07:00,400
But what I want to do is basically to add it to a chosen user array.

113
00:07:00,420 --> 00:07:06,300
OK but I need to also think I need to make sure that that user is not already there.

114
00:07:06,320 --> 00:07:11,760
Now from the beginning of the app that user would not be but what if I tapped on it again I could add

115
00:07:11,760 --> 00:07:17,940
it twice so I'm going to basically check to see if the chosen user array does not already have that

116
00:07:17,940 --> 00:07:18,620
user.

117
00:07:18,660 --> 00:07:19,500
Then we can add them.

118
00:07:19,500 --> 00:07:27,960
So we're going to type if chosen user array contains and we can use that to basically check to see if

119
00:07:27,960 --> 00:07:29,070
it contains this e-mail.

120
00:07:29,070 --> 00:07:35,520
So let's go ahead and type cell dot e-mail label dot text and we have to force unwrap it since it is

121
00:07:35,520 --> 00:07:43,200
coming in optionally so contains basically just checks to see if the Saray contains this value if it

122
00:07:43,200 --> 00:07:47,060
contains the cell email text.

123
00:07:47,250 --> 00:07:52,680
We can do something but what we are checking actually is if it does not contain because that's the only

124
00:07:52,680 --> 00:07:55,010
way that we're going to add it as if it is not already there.

125
00:07:55,020 --> 00:08:01,260
So go ahead and type the exclamation mark there to basically use the logical not to flip it.

126
00:08:01,260 --> 00:08:07,980
So if chosen user array does not contain are seldom e-mail that text we're going to go ahead and we're

127
00:08:07,980 --> 00:08:15,800
going to it so chosen user array append cell e-mail label dot text.

128
00:08:15,800 --> 00:08:23,560
Ok so then the chosen user array has our e-mail but we need to display it here on this label.

129
00:08:23,570 --> 00:08:27,610
Now let's go ahead and let's scroll up to see what we named it Group Member label 0.

130
00:08:27,620 --> 00:08:30,980
And you know what it looks like we have actually improperly set up this IAB outlet.

131
00:08:30,980 --> 00:08:32,830
So let's go fix that in the storyboard

132
00:08:36,280 --> 00:08:40,900
k it looks like oh yeah we named the stack for you the wrong thing.

133
00:08:40,900 --> 00:08:47,140
So let's go ahead let's select the stack you remove create groups we see and we can actually just go

134
00:08:47,140 --> 00:08:57,220
ahead and open up the assistant editor here open up automatic and just a second get the spinning pinwheel

135
00:08:57,220 --> 00:09:07,810
of doom Well just wait for it for a second and we'll go to automatic create groups we see very good.

136
00:09:07,810 --> 00:09:15,130
And you can see here you I stack is not correct it's really a label and we can drag that and drop it

137
00:09:15,490 --> 00:09:20,780
on the proper label OK close the assistant editor click groups AVC

138
00:09:25,170 --> 00:09:30,330
And now we can go in and use group member labels so let's scroll down and what we're going to do is

139
00:09:30,330 --> 00:09:35,710
whenever we tap on the user if I tap on Marty at great Scott dotcom I want him to show up here.

140
00:09:35,730 --> 00:09:37,210
I want his email to appear there.

141
00:09:37,200 --> 00:09:39,780
So what I'm going to do is actually really cool.

142
00:09:39,780 --> 00:09:45,780
I'm going to set the text to be equal to this array but we're going to do something really cool to pull

143
00:09:45,780 --> 00:09:48,210
out the values and make them look nice.

144
00:09:48,210 --> 00:09:54,210
So go ahead and type group member label dot text and that's going to be equal to chosen user array.

145
00:09:54,210 --> 00:09:58,650
Now there's something we can do called joined with separator.

146
00:09:58,740 --> 00:10:06,410
Select that and I'll show you what it is returns a new string by concatenating the elements of the sequence

147
00:10:06,530 --> 00:10:09,210
adding the given separator between each element.

148
00:10:09,230 --> 00:10:11,850
So check this out right now our e-mail array looks like this.

149
00:10:11,850 --> 00:10:15,590
We have strings in an array.

150
00:10:15,650 --> 00:10:22,190
If we do joined with separator we can add this separator a comma and a space between every one and it's

151
00:10:22,190 --> 00:10:26,250
going to go ahead and create a nice single string with our separator.

152
00:10:26,300 --> 00:10:29,600
So go ahead and put some quotes put a comma and a space.

153
00:10:29,750 --> 00:10:35,330
And now every single time we tap on a user and they're added to the array are our group text labels

154
00:10:35,330 --> 00:10:39,550
going to update with a list of all the peoples names with commas and everything.

155
00:10:39,550 --> 00:10:41,230
It's really really cool actually.

156
00:10:41,510 --> 00:10:42,830
So that's great.

157
00:10:42,830 --> 00:10:46,140
Now what if they are already in the array.

158
00:10:46,280 --> 00:10:47,340
We need to remove them.

159
00:10:47,420 --> 00:10:50,640
So if we added Marty at great Scott his name would be here.

160
00:10:50,750 --> 00:10:53,320
But what if we wanted to remove him.

161
00:10:53,660 --> 00:10:58,680
That would mean if the chosen user array does contain this email we need to pull them out.

162
00:10:58,700 --> 00:11:04,520
But as you know arrays do not have the ability to be pulled out by a certain name or a key that's a

163
00:11:04,520 --> 00:11:05,460
dictionary.

164
00:11:05,510 --> 00:11:11,900
So we need to basically use a handy dandy swift feature called Filter and we're going to basically filter

165
00:11:11,900 --> 00:11:15,880
our array to keep everybody that is not us.

166
00:11:16,010 --> 00:11:21,650
So let's say we added Marty at great Scott market of slopes and Harvey Dent income if I wanted to remove

167
00:11:21,680 --> 00:11:26,650
Mark I would filter the whole array to keep everybody except for Mark.

168
00:11:26,660 --> 00:11:28,320
So here's how we're going to do that.

169
00:11:28,370 --> 00:11:31,100
We're going to go ahead and call chosen user right.

170
00:11:31,440 --> 00:11:32,360
OK.

171
00:11:32,840 --> 00:11:38,570
And we're going to set it to be equal to the same thing chosen user array and you're probably thinking

172
00:11:38,570 --> 00:11:39,260
like what.

173
00:11:39,260 --> 00:11:40,470
Why would you do that.

174
00:11:40,850 --> 00:11:48,480
But the reason for that is because we can call filter and it's going to return to us a modified array.

175
00:11:48,500 --> 00:11:56,750
Now we need to put some curly brackets and then inside of this filter we can use a temporary variable.

176
00:11:56,750 --> 00:12:05,660
Now if you think about a for loop you could say for x in a number of houses and you could say X dot

177
00:12:06,200 --> 00:12:09,270
area equals 1000 square feet.

178
00:12:09,410 --> 00:12:14,960
So you could use X as a temporary variable to cycle through an array filter is kind of like a for loop

179
00:12:15,200 --> 00:12:19,280
except for the temporary variable you can just use dollar sign 0.

180
00:12:19,520 --> 00:12:24,590
And that's like a temporary placeholder variable that's used now for this case.

181
00:12:24,590 --> 00:12:30,440
We want to remove or we want to keep everybody that is not the current cell.

182
00:12:30,440 --> 00:12:38,590
So if I wanted to remove Mark I could click on it since Mark would be already in our chosen user array.

183
00:12:38,660 --> 00:12:42,500
I can filter everybody and I can keep everybody that it's not him.

184
00:12:42,500 --> 00:12:51,800
So for instance in this instance Mark would be cell email labeled text so chosen user or a filter means

185
00:12:51,920 --> 00:12:57,380
what we're going to do is we're going to filter and return back everybody that is not equal to the current

186
00:12:57,380 --> 00:13:00,220
cell e-mail label text.

187
00:13:00,280 --> 00:13:00,900
OK.

188
00:13:01,100 --> 00:13:03,620
We'll return everybody that's not equal to that.

189
00:13:03,740 --> 00:13:10,470
And then the chosen user array will be updated with everybody except for the person who we tapped.

190
00:13:10,490 --> 00:13:11,650
Very cool.

191
00:13:11,660 --> 00:13:14,250
So next we need to think.

192
00:13:14,420 --> 00:13:17,350
Let's say that right now it says add people to your group.

193
00:13:17,690 --> 00:13:21,760
What if I only added one person Marty at Great Scott dotcom shows up.

194
00:13:21,770 --> 00:13:28,280
But what if I changed my mind if I undid it at this point the array would be empty and this group member

195
00:13:28,280 --> 00:13:33,140
label text would just show up as an empty string and it would the whole label would actually hide because

196
00:13:33,140 --> 00:13:34,140
we're in a stack view.

197
00:13:34,490 --> 00:13:40,040
We need to basically check to see if there is greater than one greater than or equal to one.

198
00:13:40,190 --> 00:13:41,380
It should show the name.

199
00:13:41,420 --> 00:13:45,490
But if there is less than that then we should show ad people to group.

200
00:13:45,500 --> 00:13:53,990
So go ahead and type if chosen user count is greater than or equal to one meaning if there is at least

201
00:13:53,990 --> 00:13:58,310
one person we should definitely show the chosen user.

202
00:13:58,430 --> 00:14:00,440
So go ahead and copy and paste that there.

203
00:14:00,710 --> 00:14:04,420
And we're using the chosen user joined with Comus.

204
00:14:04,880 --> 00:14:11,990
Otherwise meaning if there are zero people there group member label that text should be equal to add

205
00:14:12,050 --> 00:14:15,120
people to your group so that what it says.

206
00:14:15,140 --> 00:14:16,940
Yeah add people to your group.

207
00:14:16,940 --> 00:14:18,700
Now there's another thing that's really important.

208
00:14:18,700 --> 00:14:23,510
We have a done button here but we have not added anybody to our group so the done button should not

209
00:14:23,510 --> 00:14:25,120
be visible.

210
00:14:25,220 --> 00:14:28,190
We should only make it visible once we've added somebody to our group.

211
00:14:28,190 --> 00:14:33,740
So let's go ahead let's hide it from the get go in view will appear.

212
00:14:37,380 --> 00:14:38,030
Phew.

213
00:14:38,040 --> 00:14:38,930
I can't type today.

214
00:14:38,930 --> 00:14:43,980
You will appear superdog view will appear and pass in animated.

215
00:14:43,980 --> 00:14:49,650
Then we're going to go ahead and just set the done button is hidden is true.

216
00:14:50,210 --> 00:14:51,130
OK.

217
00:14:51,270 --> 00:14:55,140
Next we're going to set it so that it appears when we add somebody.

218
00:14:55,140 --> 00:14:59,080
So when we tap on somebody we append them to our array.

219
00:14:59,310 --> 00:15:04,350
The Done button should definitely be showing so done.

220
00:15:04,380 --> 00:15:06,630
Buttons is hidden is false.

221
00:15:06,630 --> 00:15:11,430
And then the only other time that it should show again is if we remove everybody from our group.

222
00:15:11,430 --> 00:15:15,740
So one button is hidden equals true.

223
00:15:16,310 --> 00:15:16,560
OK.

224
00:15:16,560 --> 00:15:19,800
So you know we've done a lot of code writing without checking to see if this works.

225
00:15:19,800 --> 00:15:21,330
Let's go ahead and build and run.

226
00:15:21,330 --> 00:15:24,500
Let's go see if we properly are adding people.

227
00:15:25,020 --> 00:15:32,000
And let's let's give a shot let's go look to see if we can add people and remove them et cetera et cetera.

228
00:15:32,240 --> 00:15:32,690
OK.

229
00:15:32,830 --> 00:15:37,590
Group's new group let's search for calm.

230
00:15:37,680 --> 00:15:38,760
Let's click on Marty.

231
00:15:38,760 --> 00:15:39,910
Great Scott.

232
00:15:39,930 --> 00:15:41,850
Looks like he's showing up as user at break point.

233
00:15:41,850 --> 00:15:42,910
That's kind of weird.

234
00:15:43,130 --> 00:15:44,530
Let's go ahead and remove him.

235
00:15:44,700 --> 00:15:45,120
OK good.

236
00:15:45,120 --> 00:15:49,060
So the button shows and hides let's add market slopes.

237
00:15:49,560 --> 00:15:52,360
Harvey a dent.

238
00:15:52,400 --> 00:15:54,260
Let's try to add two people.

239
00:15:54,620 --> 00:15:54,890
OK.

240
00:15:54,890 --> 00:15:59,440
When we try to add two people it's showing and hiding and they're all going away.

241
00:15:59,450 --> 00:16:01,350
So it's not actually working.

242
00:16:01,350 --> 00:16:03,250
They're not showing up the right way.

243
00:16:03,260 --> 00:16:07,100
So we need to go do some work here to add them in.

244
00:16:07,100 --> 00:16:13,950
And I'm just kind of wondering why it is that we are not getting everybody like we should be.

245
00:16:14,020 --> 00:16:17,960
It appears that we are not actually getting the proper cell.

246
00:16:17,960 --> 00:16:21,330
We're not really getting a value from any of these cells.

247
00:16:21,350 --> 00:16:25,030
And I wonder oh you know what.

248
00:16:25,100 --> 00:16:25,520
Shoot.

249
00:16:25,550 --> 00:16:26,930
I just realized what the deal is.

250
00:16:26,930 --> 00:16:32,720
Guys we are cueing a reusable cell we need to actually download the real cell and we can do that by

251
00:16:32,720 --> 00:16:34,900
calling cell for road index path.

252
00:16:34,910 --> 00:16:36,370
Gosh let's do that.

253
00:16:36,380 --> 00:16:43,130
So cell self-growth index path is going to let us get the actual cell pull the actual value and add

254
00:16:43,130 --> 00:16:43,880
it to our array.

255
00:16:43,880 --> 00:16:46,570
That's the problem we were pulling down a blank cell.

256
00:16:46,580 --> 00:16:52,060
Let's go ahead and let's build and run this again and let's go see if that fixed our problem.

257
00:16:52,130 --> 00:16:57,710
That is a big problem actually because dequeue reuseable cell is pulling down a temporary cell but we

258
00:16:57,710 --> 00:16:59,750
need to actually pull down the cell that's been downloaded.

259
00:16:59,750 --> 00:17:03,320
So let's go try that again type dot com and let's tap Marty it.

260
00:17:03,320 --> 00:17:04,950
Great Scott there he is.

261
00:17:05,030 --> 00:17:06,400
Let's tap market slopes.

262
00:17:06,410 --> 00:17:10,370
Hey he added Harvey Dent and he added but we can't see him.

263
00:17:10,370 --> 00:17:16,280
So it looks like we need to fix that label and set it so that the font can scale down to the appropriate

264
00:17:16,280 --> 00:17:16,610
size.

265
00:17:16,610 --> 00:17:18,030
So let's go set that right now.

266
00:17:28,900 --> 00:17:35,840
OK so just click on the label click fixed font size and set it to minimum font size and size 8 should

267
00:17:35,840 --> 00:17:36,890
be good.

268
00:17:36,920 --> 00:17:39,210
Let's build and run it just to make sure that it's working.

269
00:17:39,230 --> 00:17:40,980
One more time.

270
00:17:41,150 --> 00:17:42,410
And guys that's pretty awesome.

271
00:17:42,410 --> 00:17:48,480
It looks like we are successfully adding people into our chosen user array displaying them in that label.

272
00:17:48,680 --> 00:17:52,840
And let's just go see it again let's make sure it worked let's just search dot com.

273
00:17:52,880 --> 00:17:54,300
Everybody has dot com.

274
00:17:54,320 --> 00:17:55,320
Marty.

275
00:17:55,330 --> 00:17:57,540
Mark Harvey Hey look at that.

276
00:17:57,590 --> 00:17:59,130
Even me.

277
00:17:59,340 --> 00:18:03,600
And if I uncheck it you'll see that it removes the person that we asked.

278
00:18:03,630 --> 00:18:04,910
Really cool.

279
00:18:05,130 --> 00:18:05,340
Wow.

280
00:18:05,340 --> 00:18:07,650
That is so so awesome.

281
00:18:07,680 --> 00:18:10,140
So it looks like it's adding everybody in.

282
00:18:10,280 --> 00:18:13,030
And if I wanted to even remove Evan.

283
00:18:13,200 --> 00:18:17,550
Yes and it goes back exactly how we wanted it to add people to your group.

284
00:18:17,550 --> 00:18:24,720
Super super cool the only thing the only thing that we still need to fix is we need to basically set

285
00:18:24,720 --> 00:18:30,850
the cell so that it is unchecked by default and then we can tap on it and check it properly.

286
00:18:30,870 --> 00:18:33,330
So let's go into create groups visi.

287
00:18:33,450 --> 00:18:39,090
Let's go to configure cell because remember we are configuring the cell by default to be selected.

288
00:18:39,090 --> 00:18:40,640
And that's not going to work.

289
00:18:40,650 --> 00:18:44,730
Basically what we're going to do is we're going to check the index path of the cell and we're going

290
00:18:44,730 --> 00:18:50,760
to compare it to the chosen user array to see if the chosen use or array is already selected.

291
00:18:50,850 --> 00:18:55,980
Because if they're in the chosen user array they should not be or they should show as selected.

292
00:18:55,980 --> 00:19:06,490
So let's go ahead and let's type if chosen user array contains email or array index path that row k

293
00:19:06,870 --> 00:19:08,880
if it contains them.

294
00:19:09,330 --> 00:19:14,890
Then we're going to set up the cell to be selected right because if they're in the chosen use array

295
00:19:14,910 --> 00:19:17,990
if we've already tapped on them they should be configured as selected.

296
00:19:18,240 --> 00:19:24,300
If they're not meaning else we should configure this cell as false because they're not selected they're

297
00:19:24,300 --> 00:19:26,380
not in our chosen users array.

298
00:19:26,910 --> 00:19:32,040
And as soon as the table views reloaded all of the cells will show the proper checkmark So let's go

299
00:19:32,040 --> 00:19:33,990
build and run this let's see if it worked.

300
00:19:34,080 --> 00:19:39,440
And we should be good to move on to the next video where we're going to actually create our group upload

301
00:19:39,440 --> 00:19:42,060
it to firebase and add ourselves in.

302
00:19:42,060 --> 00:19:46,810
So let's go try it click on groups new group let's add maybe.

303
00:19:47,020 --> 00:19:47,560
OK.

304
00:19:47,580 --> 00:19:48,640
So nobody is selected.

305
00:19:48,690 --> 00:19:49,130
That's great.

306
00:19:49,130 --> 00:19:53,730
If I select somebody they appears checked if I select Harvey.

307
00:19:53,910 --> 00:19:57,810
He appears is checked and you know what let's actually get rid of this and try it again to see if they

308
00:19:57,810 --> 00:19:58,500
stay checked.

309
00:19:58,500 --> 00:19:59,430
They do.

310
00:19:59,640 --> 00:20:01,360
Harvey staes checked.

311
00:20:01,620 --> 00:20:08,880
Let's add homini and let's go back and search dotcom looks like everybody is here.

312
00:20:08,880 --> 00:20:10,080
Awesome.

313
00:20:10,080 --> 00:20:13,860
Very cool so the checkmarks stay they stay properly configured.

314
00:20:13,860 --> 00:20:18,570
We can add everybody into our tray and in the next video we're going to actually set it so that we can

315
00:20:18,570 --> 00:20:21,190
push our group up to firebase and save it.

316
00:20:21,190 --> 00:20:22,760
They're super super cool guys.

317
00:20:22,770 --> 00:20:23,400
Amazing work.

318
00:20:23,400 --> 00:20:25,220
Let's move on to the next video.
