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