1
00:00:05,510 --> 00:00:06,960
Yo what's up everyone.

2
00:00:06,970 --> 00:00:09,590
Mark Price here at Dove slopes dot com.

3
00:00:09,610 --> 00:00:11,620
And let's continue building our app here.

4
00:00:11,620 --> 00:00:12,880
We're making great progress.

5
00:00:12,880 --> 00:00:19,390
We want to do next is actually have this product screen show and we want to get our collection view

6
00:00:19,390 --> 00:00:21,730
all configured etc. etc..

7
00:00:21,730 --> 00:00:29,080
So first things is we need to make sure we have an identifier on our Segway So click your Segway and

8
00:00:29,170 --> 00:00:31,080
then add the attributes and Specter over here.

9
00:00:31,180 --> 00:00:36,220
Set an identifier and I like to just set this to The View Controller that we are going to which I believe

10
00:00:36,220 --> 00:00:39,970
is the product B C

11
00:00:42,440 --> 00:00:42,980
category.

12
00:00:43,040 --> 00:00:44,480
So we haven't created it yet.

13
00:00:44,480 --> 00:00:47,000
Well we should do that and then we'll set the identifier.

14
00:00:47,000 --> 00:00:54,350
So in your controller folder Let's go to new file Cocco touch class and instead of view collection.

15
00:00:54,350 --> 00:01:06,610
So we will say you view controller and we will call this product B C press Enter create.

16
00:01:06,900 --> 00:01:07,180
OK.

17
00:01:07,200 --> 00:01:09,220
Now we'll go back to the main storyboard here.

18
00:01:09,360 --> 00:01:15,890
We'll select our view controller will change its class to the products we see wonderful.

19
00:01:15,960 --> 00:01:23,960
And then on the segue here now we can set the identifier to products Visi save it there.

20
00:01:24,170 --> 00:01:24,430
OK.

21
00:01:24,450 --> 00:01:26,850
So the Segway identifiers in there.

22
00:01:26,850 --> 00:01:33,690
Let's go back to our categories Visi and what we want to do is when a category is selected like tapped

23
00:01:33,780 --> 00:01:39,030
we want to show another view controllers are really all we're doing here is presenting a Segway and

24
00:01:39,030 --> 00:01:43,950
then passing that appropriate data into the other view controller that we're going to be going to how

25
00:01:43,950 --> 00:01:44,590
do we do that.

26
00:01:44,590 --> 00:01:53,100
Well the Table View delegate has a really cool function called did select row an index path.

27
00:01:53,100 --> 00:01:59,000
One thing that's really important is that you don't accidentally click did de-select so did de-select.

28
00:01:59,110 --> 00:02:03,930
Ok that's when they've selected and taken their finger off a lot of new developers actually enter this

29
00:02:03,930 --> 00:02:07,020
in and then the table view is not working correctly when you're tapping it.

30
00:02:07,020 --> 00:02:11,330
So we did select a row index path.

31
00:02:11,550 --> 00:02:12,150
OK.

32
00:02:12,600 --> 00:02:17,160
So we're going to tap roll is going to tell us which row is tapped and then we can build out some logic

33
00:02:17,160 --> 00:02:17,580
here.

34
00:02:17,610 --> 00:02:18,690
No big deal.

35
00:02:18,690 --> 00:02:22,360
So first things first is let's grab the appropriate category that was tapped.

36
00:02:22,470 --> 00:02:37,680
So let category category equals data service get categories and data service get categories and we're

37
00:02:37,680 --> 00:02:41,140
going to say Index path dot row.

38
00:02:41,670 --> 00:02:42,120
OK.

39
00:02:42,210 --> 00:02:45,790
So we're just grabbing the category.

40
00:02:45,900 --> 00:02:50,320
You know I think it's good category.

41
00:02:50,670 --> 00:02:57,650
Now that's correct datasource get category it's trippin out it's just trippin out here.

42
00:02:57,690 --> 00:03:04,300
I'm going to copy what we have up here because this one is trippin out tax code and it's trippin.

43
00:03:04,540 --> 00:03:05,220
All right.

44
00:03:05,470 --> 00:03:06,670
So there's our category.

45
00:03:06,910 --> 00:03:07,800
Wonderful.

46
00:03:07,810 --> 00:03:14,080
And then what we want to do is say perform a segue like so with identifier where we know it's the products

47
00:03:14,100 --> 00:03:18,150
Visi Segway and the sender basically will object.

48
00:03:18,160 --> 00:03:19,280
We want to pass this.

49
00:03:19,300 --> 00:03:22,030
So when I prepare for SEGUI is called We have data available to us.

50
00:03:22,030 --> 00:03:28,180
And this is where we pass in that category so we're passing in data here into our perform Segway.

51
00:03:28,360 --> 00:03:35,740
So then when prepare for Segway is called We can then pass that over into our products and then sell

52
00:03:35,740 --> 00:03:38,920
it to the prepare for Segway function like so.

53
00:03:38,940 --> 00:03:50,430
And you've done this before if let products be C equals Segway destination as products B.

54
00:03:50,440 --> 00:03:55,530
So we're describing the destination View Controller and we're casting it into the appropriate view controller.

55
00:03:55,710 --> 00:03:56,270
Okay.

56
00:03:56,590 --> 00:04:02,740
And then what we'll do is we will set the category on that controller but we don't have any variables

57
00:04:02,740 --> 00:04:03,520
or anything for that yet.

58
00:04:03,520 --> 00:04:09,310
So what I want to do is go to my products Visi get rid of this comment here.

59
00:04:09,370 --> 00:04:16,300
And what I want to do is see what it did receive memory warning is its great function here called initialized

60
00:04:16,300 --> 00:04:17,160
products.

61
00:04:17,460 --> 00:04:18,130
Okay.

62
00:04:18,670 --> 00:04:26,170
And then what we'll do is we'll pass in a room what do we want to call this exactly initialized products

63
00:04:26,500 --> 00:04:32,500
for like a category title like will pass in a title or just pass and the whole category just thinking

64
00:04:32,500 --> 00:04:33,420
aloud here.

65
00:04:33,680 --> 00:04:34,470
OK.

66
00:04:34,960 --> 00:04:36,410
Products category.

67
00:04:36,970 --> 00:04:38,010
Wonderful.

68
00:04:38,050 --> 00:04:43,930
And then what we'll do here is we'll actually store a list of products so same must be done before private

69
00:04:43,930 --> 00:04:44,840
set.

70
00:04:45,400 --> 00:04:54,220
And then it's if I can type public var and this one is going to be called products.

71
00:04:54,240 --> 00:04:54,790
All right.

72
00:04:54,970 --> 00:05:05,740
And it's going to be an empty array type product like so if you're wondering why we're making this an

73
00:05:05,740 --> 00:05:06,550
empty array.

74
00:05:06,660 --> 00:05:14,370
And the reason is let's say that we the data hasn't loaded yet you're getting it from the internet somewhere.

75
00:05:14,530 --> 00:05:17,450
Well you want an empty array to base your collection view off of.

76
00:05:17,470 --> 00:05:19,570
Otherwise it will just nail your collection.

77
00:05:19,570 --> 00:05:24,740
You would look for an item and your app would crash so that's why we're creating an empty array here.

78
00:05:25,090 --> 00:05:25,640
OK.

79
00:05:25,870 --> 00:05:30,880
And what we're going to do here is simply use the function that we already built in our data service

80
00:05:30,880 --> 00:05:34,450
to get the appropriate product for this category that we are passing in.

81
00:05:34,720 --> 00:05:40,660
OK so what we're going to do is we're going to say self X I don't need to say self-heating to say products

82
00:05:40,840 --> 00:05:44,070
equals data service.

83
00:05:44,640 --> 00:05:51,440
And since get products for category title we're going to say category title.

84
00:05:51,610 --> 00:05:55,840
So it's going to happen as our products array is going to be populated with products and we're just

85
00:05:55,840 --> 00:06:01,520
passing in the title that was passed in the categories we see here to the products AVC.

86
00:06:01,620 --> 00:06:08,790
And so now this initialized products function we can actually call from right here so we can say products

87
00:06:08,790 --> 00:06:20,610
AVC dot initialized products and we can pass in the sender as a product or category that we go like

88
00:06:20,610 --> 00:06:25,360
so.

89
00:06:25,400 --> 00:06:29,750
So what we're doing here is we're grabbing the products Visi and then we're just calling that initialized

90
00:06:29,750 --> 00:06:31,640
products function that we just created.

91
00:06:31,640 --> 00:06:37,270
Sender you're like what descender center is just the category that we passed and so remember up here

92
00:06:37,280 --> 00:06:41,570
when ended Slik ROA index path we passed in the category to the sender.

93
00:06:41,570 --> 00:06:46,520
All we're doing here is grabbing the sender because when you pass it in the parameter type is any like

94
00:06:46,550 --> 00:06:47,650
any object.

95
00:06:47,690 --> 00:06:52,940
And so we have to specify that this is a category so sender as category and why am I force in wrapping

96
00:06:52,940 --> 00:06:59,600
it because I know for a fact that it is a category because I just set it right there because you can

97
00:06:59,600 --> 00:07:01,820
be sure that this is going to cast correctly.

98
00:07:01,910 --> 00:07:06,750
So products VCDs initialized products sender as category.

99
00:07:06,770 --> 00:07:07,240
Okay.

100
00:07:07,250 --> 00:07:12,880
And one thing that we probably want to do here is create an assertion so build time.

101
00:07:12,920 --> 00:07:17,020
We know that this is working correctly and then I'll feel more comfortable using that force unwrap.

102
00:07:17,150 --> 00:07:18,390
So let's do that now.

103
00:07:19,160 --> 00:07:30,580
But we're going to say assert that sender as with a question mark category is not equal to nil.

104
00:07:30,910 --> 00:07:31,680
Okay.

105
00:07:31,700 --> 00:07:36,500
And this assertion is good because what it is going to do is at build time.

106
00:07:36,530 --> 00:07:38,050
This is only for build time.

107
00:07:38,090 --> 00:07:40,030
Develop motets not for production.

108
00:07:40,270 --> 00:07:44,930
What's going to happen is this assertion is going to be called and it's going to say it absolutely must

109
00:07:44,930 --> 00:07:48,650
be of type category when we cast it and if it's not it's going to crash your app at build time.

110
00:07:48,680 --> 00:07:52,550
As a developer so as a developer you're going through you're building your project and then you go in

111
00:07:52,550 --> 00:07:56,630
here and then your app crashes you know that you need to fix it we're forcing a crash here if it's not

112
00:07:56,630 --> 00:07:56,990
working.

113
00:07:56,990 --> 00:07:59,410
So at runtime it will definitely work.

114
00:07:59,560 --> 00:08:02,990
OK this is just a layer of protection in your development that will help you out.

115
00:08:02,990 --> 00:08:06,790
Now you maybe you think it will mark why didn't you do a guard statement in the casting.

116
00:08:06,790 --> 00:08:07,100
OK.

117
00:08:07,100 --> 00:08:10,750
Or why didn't you do and if let if let sender ask category.

118
00:08:10,760 --> 00:08:16,740
Well the reason I didn't do an if or guard is because my application requires this to be a category.

119
00:08:16,760 --> 00:08:18,050
It's not chance.

120
00:08:18,050 --> 00:08:18,640
OK.

121
00:08:18,860 --> 00:08:22,150
It's not user base where it might be a category it might be something else.

122
00:08:22,160 --> 00:08:25,470
Ok if that was the case we would use the guard or an IF let.

123
00:08:25,520 --> 00:08:30,680
But since my app requires that this is a category when we cast it it makes more sense to use an assertion.

124
00:08:30,740 --> 00:08:31,870
So build time.

125
00:08:32,000 --> 00:08:35,030
If it's not working it crashes our app which is what we want.

126
00:08:35,140 --> 00:08:36,380
OK we can guarantee it no.

127
00:08:36,380 --> 00:08:44,140
So I feel a lot better about force unwrapping the this or forecasting this here so we're initialising

128
00:08:44,150 --> 00:08:46,910
the products center as category this is great.

129
00:08:46,910 --> 00:08:53,630
And then in the products you see it's going to go ahead and set the products to the products that we

130
00:08:54,080 --> 00:08:55,940
have here in our data service.

131
00:08:55,940 --> 00:08:59,870
So the next thing we need to do is get our collection of view actually working.

132
00:08:59,870 --> 00:09:04,970
So let's implement a couple of protocols put a comma after you view controller and we're going to use

133
00:09:05,010 --> 00:09:14,190
a collection of view delegate and UI collection view data source like we've done before.

134
00:09:14,190 --> 00:09:19,640
And of course we need the outlet for our collection of views at Iby outlet weak var and we're going

135
00:09:19,640 --> 00:09:25,540
to say products collection of type you collection view.

136
00:09:26,070 --> 00:09:26,700
OK.

137
00:09:27,020 --> 00:09:28,540
And we're putting the exclamation there at the end.

138
00:09:28,550 --> 00:09:31,180
Meaning it's an implicitly unwrapped optional.

139
00:09:31,190 --> 00:09:34,730
And it's saying hey you haven't implemented the function so click the red button up here.

140
00:09:34,740 --> 00:09:35,930
Do you want to add protocol stubs.

141
00:09:35,960 --> 00:09:37,330
Absolutely.

142
00:09:37,340 --> 00:09:44,760
So command X protocol stubs will put them where they actually belong down here get to get rid of the

143
00:09:44,760 --> 00:09:52,220
available nonsense and this year the code and get rid of that their income and what we'll do here you

144
00:09:52,280 --> 00:10:00,840
did load is we will say products collection datasource equals self and products collection delegate

145
00:10:01,250 --> 00:10:09,120
equals self OK we are saying that hey this collection of view is going to be the delegate and implement

146
00:10:09,120 --> 00:10:14,390
the protocols the appropriate protocols to get this working OK.

147
00:10:14,540 --> 00:10:16,860
And so a number of items in section.

148
00:10:16,860 --> 00:10:18,180
Now there are multiple.

149
00:10:18,210 --> 00:10:21,440
You could have an app with multiple sections a collection view or table view.

150
00:10:21,450 --> 00:10:22,790
In our case we only have one.

151
00:10:22,950 --> 00:10:27,420
So what I'm going to do is just simply return products that count.

152
00:10:27,420 --> 00:10:34,840
Otherwise what you might have done is you might have said if Section equals 1 then you return three

153
00:10:35,010 --> 00:10:35,620
you know.

154
00:10:35,670 --> 00:10:36,290
Or.

155
00:10:36,600 --> 00:10:39,530
Well you know whatever number it is or some other collection.

156
00:10:39,690 --> 00:10:41,700
Else if Section equals to return this money.

157
00:10:41,700 --> 00:10:48,060
But in our case again we only have one section so we're going to return products that count and then

158
00:10:48,060 --> 00:10:49,530
sell for item index path.

159
00:10:49,530 --> 00:10:52,540
This is very similar to what we've done with the table view.

160
00:10:52,980 --> 00:11:01,610
Okay we're simply going to say if let sell equals collection view dequeue reusable sell.

161
00:11:01,650 --> 00:11:05,660
And this one's going to be the product sell.

162
00:11:05,670 --> 00:11:09,900
I think that's what we called it or what we will call it if we haven't done it yet for index path and

163
00:11:09,900 --> 00:11:14,790
in this case it's looking for the index path that's being passed in right here from the function.

164
00:11:14,790 --> 00:11:17,080
So there's our cell if let's sell.

165
00:11:17,160 --> 00:11:21,880
And then what we want to do in the cell is just passing the data that we're going to need.

166
00:11:22,080 --> 00:11:27,620
And so let's look at our cell product cell and we don't have a way to update the data here so let's

167
00:11:27,620 --> 00:11:29,300
create our function to do that.

168
00:11:29,300 --> 00:11:35,600
So function update views and we're going to pass in a product.

169
00:11:35,600 --> 00:11:38,750
We've done this before with the table view very similar.

170
00:11:38,750 --> 00:11:46,520
And what we'll say is we will say product image image equals image named.

171
00:11:46,790 --> 00:11:57,680
And this is going to be product image name and then product title text equals product title and product

172
00:11:57,710 --> 00:11:58,440
price.

173
00:11:58,580 --> 00:12:01,890
Text equals product price.

174
00:12:01,940 --> 00:12:07,760
So all we're doing here is every time a collection view cell is created or Decoud we're going to pass

175
00:12:07,760 --> 00:12:10,070
in the appropriate product and update the view.

176
00:12:10,070 --> 00:12:14,790
So it's showing the correct data and this is important because of views on a collection of cell and

177
00:12:15,480 --> 00:12:17,480
collection of you and a table of you are recycled.

178
00:12:17,540 --> 00:12:19,650
So we have to continually update the views.

179
00:12:19,830 --> 00:12:20,570
OK.

180
00:12:20,930 --> 00:12:22,190
So that looks good there.

181
00:12:22,190 --> 00:12:27,890
So back in our products we see what we can do now is we can grab the appropriate product and then pass

182
00:12:27,890 --> 00:12:35,080
it into the cell so we can say let product equals products index path dot row.

183
00:12:35,180 --> 00:12:40,190
Okay we're grabbing the appropriate Roe for the products and we're storing for the product and we're

184
00:12:40,190 --> 00:12:46,430
storing it here in this product constant and then sell that update views.

185
00:12:46,960 --> 00:12:48,490
We forgot to cast it.

186
00:12:48,560 --> 00:12:56,880
So let's cast that now so as it were in safe product sale never go now it knows it's a product sell.

187
00:12:56,890 --> 00:13:04,010
Once I sell that update views and we'll pass in the product and then we will return the cell as the

188
00:13:04,010 --> 00:13:05,610
function requires.

189
00:13:05,630 --> 00:13:10,550
Otherwise if this didn't cast appropriately like when we converted the cell it didn't it wasn't a product

190
00:13:10,550 --> 00:13:14,450
cell which could happen if you had like a head or cell or some of you had multiple different types of

191
00:13:14,450 --> 00:13:19,100
cells for a single collection which you can maybe you have one cell that looks one way for a certain

192
00:13:19,100 --> 00:13:22,710
type of data and another cell it looks the other way you might have two collection B cells.

193
00:13:22,820 --> 00:13:28,910
In our case we only have one eye but we still need this statement here or rather you don't even need

194
00:13:28,910 --> 00:13:29,600
an else statement.

195
00:13:29,590 --> 00:13:36,900
You could just say return and then we could say product cell because it would never get here if you

196
00:13:36,950 --> 00:13:39,070
made it through this portion here.

197
00:13:39,490 --> 00:13:39,790
OK.

198
00:13:39,800 --> 00:13:44,750
So great we're we are creating a cell or two cuing it we're passing in the appropriate product so it

199
00:13:44,840 --> 00:13:49,440
updates the data and then returning that cell that looks fantastic.

200
00:13:49,940 --> 00:13:55,550
And we got our products collection view here which I think even though it says it's been set I think

201
00:13:55,610 --> 00:13:58,670
it's not probably set back in the storyboard here.

202
00:13:58,730 --> 00:14:04,130
Select your controller right click it and you see that product's collection is definitely not set it's

203
00:14:04,130 --> 00:14:07,010
lying to us as drag it over there.

204
00:14:07,310 --> 00:14:08,340
OK.

205
00:14:08,340 --> 00:14:13,790
And let's also make sure our cell has a reuse identifier so go to your product cell and it does not

206
00:14:14,390 --> 00:14:16,010
give us a reuse identifier.

207
00:14:16,100 --> 00:14:17,920
And we are going to call it product cell.

208
00:14:18,050 --> 00:14:21,380
You have to have this so the cells can be reused.

209
00:14:21,380 --> 00:14:21,790
OK.

210
00:14:21,980 --> 00:14:23,320
Let's go ahead and give this a spin.

211
00:14:23,400 --> 00:14:24,370
Let's just see where we are.

212
00:14:24,380 --> 00:14:28,440
See for even runs I'm feeling good about it so far.

213
00:14:28,460 --> 00:14:30,200
We could have forgotten something though.

214
00:14:30,710 --> 00:14:31,050
OK.

215
00:14:31,100 --> 00:14:33,000
Moment of Truth when we click one of these.

216
00:14:33,080 --> 00:14:34,290
We should see the next screen load.

217
00:14:34,310 --> 00:14:35,550
And it should show the appropriate data.

218
00:14:35,550 --> 00:14:42,680
So I'm going click hoodies and it's working so we've got our hoodies Dove soaps logo gray red gray and

219
00:14:42,680 --> 00:14:45,470
black so our data is definitely populating.

220
00:14:45,470 --> 00:14:47,810
As expected a couple things.

221
00:14:47,820 --> 00:14:51,390
Is this code Her swag is really annoying and it's not supposed to be there.

222
00:14:51,470 --> 00:14:54,410
The design that our designer gave us was just the arrow itself.

223
00:14:54,590 --> 00:14:56,210
And also there's not a title here.

224
00:14:56,390 --> 00:15:01,820
I think we need a title to show what kind of products it is and what kind of products we're showing

225
00:15:01,820 --> 00:15:02,320
rather.

226
00:15:02,510 --> 00:15:04,200
And shirts.

227
00:15:04,610 --> 00:15:06,110
So you know this looks pretty good.

228
00:15:06,580 --> 00:15:07,540
I kind of like it.

229
00:15:10,160 --> 00:15:11,980
Yeah yeah yeah yeah.

230
00:15:12,700 --> 00:15:13,130
I like it.

231
00:15:13,130 --> 00:15:14,770
So let's let's fix a couple of things.

232
00:15:14,760 --> 00:15:17,500
So what we'll do and this is empty which is great.

233
00:15:17,500 --> 00:15:23,330
So what we'll do is we'll get rid of this text here and then we'll set a title to let's the title first.

234
00:15:23,830 --> 00:15:32,610
So what we'll do is save this in the products we see when we're initialising this data here.

235
00:15:32,780 --> 00:15:35,150
Let's just go ahead and set the title and that's easy.

236
00:15:35,180 --> 00:15:44,240
As simple as saying navigation item Daut title equals we'll say category that title so to grab the title

237
00:15:44,240 --> 00:15:45,570
of the navigation bar.

238
00:15:45,680 --> 00:15:45,960
OK.

239
00:15:45,960 --> 00:15:49,520
All you have to do is grab navigation item that title and it knows how to find it and then you set it

240
00:15:49,520 --> 00:15:51,870
to the title here that is.

241
00:15:52,270 --> 00:15:53,570
That's really easy.

242
00:15:53,570 --> 00:15:58,460
The harder one is the button and you would think maybe you would do something like this navigation item

243
00:15:58,460 --> 00:16:03,590
that let's say back button right here or backbiter button item and then you know oh look at the title

244
00:16:03,590 --> 00:16:08,310
we can set the title like this equals you know let's say an empty string but it doesn't work.

245
00:16:08,360 --> 00:16:15,320
Unfortunately it does not recognize this because the the back button actually belongs to the previous

246
00:16:15,320 --> 00:16:16,210
few controller.

247
00:16:16,210 --> 00:16:16,470
OK.

248
00:16:16,460 --> 00:16:19,140
It does not belong to this one belongs to the previous one.

249
00:16:19,210 --> 00:16:21,340
So we have to do is actually go in the categories.

250
00:16:21,810 --> 00:16:22,540
OK.

251
00:16:22,600 --> 00:16:27,300
And what we can do in the categories we see is we can just set it here and prepare for segue.

252
00:16:27,310 --> 00:16:28,090
All right.

253
00:16:28,090 --> 00:16:36,370
So we can right here create a bar button item so bar button equals you bar button item you have to create

254
00:16:36,370 --> 00:16:41,140
a new one you can't modify it again like I said it's strange you think you could but you can't create

255
00:16:41,140 --> 00:16:41,860
a new one.

256
00:16:41,920 --> 00:16:44,880
And what would this was say bar button title.

257
00:16:45,010 --> 00:16:46,720
Make it an empty string.

258
00:16:47,070 --> 00:16:53,030
And now will say navigation item back bar button item equals bar button.

259
00:16:53,100 --> 00:16:55,090
Place what's there with something new.

260
00:16:55,360 --> 00:16:57,340
OK.

261
00:16:57,550 --> 00:17:00,900
And you know what I think I want to do this before I initialize anything.

262
00:17:00,970 --> 00:17:04,570
Just for good measure like so.

263
00:17:08,080 --> 00:17:09,040
Cool.

264
00:17:09,130 --> 00:17:11,250
So we've just created a bar button item.

265
00:17:11,350 --> 00:17:12,800
We said it with an empty title.

266
00:17:12,820 --> 00:17:17,520
And then what we've done is we've set the navigation item back bar button item to this new item here.

267
00:17:17,560 --> 00:17:25,450
So let's go ahead and see if that works shirts it says at the top and has the backbone Canpotex which

268
00:17:25,450 --> 00:17:26,170
is great.

269
00:17:26,170 --> 00:17:30,040
Hoodie's says hoodies hats say hats.

270
00:17:30,040 --> 00:17:30,960
Prices are different everything.

271
00:17:30,960 --> 00:17:31,720
This is really good.

272
00:17:31,720 --> 00:17:34,160
What you've done here is very important.

273
00:17:34,250 --> 00:17:34,810
OK.

274
00:17:34,960 --> 00:17:39,820
If you can if you don't have everything memorized that we've done in this series on this app then you're

275
00:17:39,820 --> 00:17:46,800
not likely to get a job as as an OS developer and the reason why is displaying data is so critical.

276
00:17:46,900 --> 00:17:50,050
OK and we've written what I call good clean code.

277
00:17:50,110 --> 00:17:52,910
So if you write code like this you'll you'll impress people.

278
00:17:53,170 --> 00:17:57,850
And what we've done is we've worked with table use reusable cells.

279
00:17:57,990 --> 00:18:02,400
We've worked with collection use which our grid system again collection of use can go horizontal if

280
00:18:02,400 --> 00:18:03,710
you want to swipe horizontally.

281
00:18:03,720 --> 00:18:10,890
You could let's say that you wanted Let's say that you wanted to be able to swipe horizontally here

282
00:18:10,920 --> 00:18:12,360
but swipe up and down here maybe this.

283
00:18:12,390 --> 00:18:17,970
Maybe we just had one page and this said hats and said shirts what you could do is you could actually

284
00:18:17,970 --> 00:18:24,330
have a table view and each cell inside the table is actually a collection view OK with a horizontal

285
00:18:24,330 --> 00:18:24,690
scroll.

286
00:18:24,690 --> 00:18:26,160
So the table view goes vertical.

287
00:18:26,160 --> 00:18:27,920
But the collection below goes horizontal.

288
00:18:28,020 --> 00:18:32,340
And so you could have this row here on the table of you cell which is a collection of you goes from

289
00:18:32,340 --> 00:18:36,720
left to right left or right left or right and that's how you would build something that goes up and

290
00:18:36,720 --> 00:18:39,140
down and left and right which is really cool of course.

291
00:18:39,270 --> 00:18:43,740
The collection itself can also do that functionality so you can do a collection view within a collection

292
00:18:43,740 --> 00:18:44,390
view.

293
00:18:44,460 --> 00:18:47,820
And we did a grid spacing here the spacing was automatic for us.

294
00:18:47,820 --> 00:18:51,030
You can change the spacing you can change the layouts and do some other nifty things.

295
00:18:51,030 --> 00:18:54,440
We didn't even begin to cover all of that here but you can change all that.

296
00:18:54,570 --> 00:19:00,480
And this has really come together you've learned how to host data in a data service using the singleton

297
00:19:00,480 --> 00:19:01,100
pattern.

298
00:19:01,110 --> 00:19:07,590
OK one instance of this class in memory you've also learned the basics of implementing the delegate

299
00:19:07,590 --> 00:19:12,720
pattern which is you have classes implement some type of protocol.

300
00:19:12,770 --> 00:19:14,220
And I will abide by these rules.

301
00:19:14,220 --> 00:19:18,930
And once those protocols are implemented X code will force you to implement the code needed for it such

302
00:19:18,930 --> 00:19:23,360
as sell for item index path etc. and then you implement those things.

303
00:19:23,370 --> 00:19:27,780
You have to make sure you set the data source and delegate on your table view or collection of view.

304
00:19:27,810 --> 00:19:31,710
Otherwise your app will not run appropriately.

305
00:19:31,740 --> 00:19:35,190
And a lot of new developers do that so you'll learn a lot of things here.

306
00:19:35,190 --> 00:19:38,920
This is the basis and foundation of what you're going to do whenever working with data.

307
00:19:39,030 --> 00:19:41,200
And we've taught you everything here the right way.

308
00:19:41,310 --> 00:19:45,320
OK the Apple way and I'm I'm happy.

309
00:19:45,360 --> 00:19:45,990
I think it's good.

310
00:19:45,990 --> 00:19:47,440
So congratulations.

311
00:19:47,490 --> 00:19:48,810
This is good stuff here.

312
00:19:48,900 --> 00:19:54,000
And let's move on and forward two other amazing apps Mark Price at deps slopes dot com.

313
00:19:54,000 --> 00:19:54,740
See you next time.

