1
00:00:07,860 --> 00:00:13,540
It hey everybody this is Caleb with slopes dot com and in this video we're going to build our finished

2
00:00:13,540 --> 00:00:18,290
goal v c which is where we're going to enter the amount of points needed to complete the goal.

3
00:00:18,610 --> 00:00:22,850
And we're also going to set it up so that we can pass data from Create Goals.

4
00:00:22,870 --> 00:00:24,820
VC over to finish goals.

5
00:00:24,820 --> 00:00:32,800
VC so that at the end once we've given it an amount of points we can save it into a single goals object

6
00:00:32,800 --> 00:00:39,040
to pass into our core data model so go ahead and pull open your X code project and load up main story

7
00:00:39,100 --> 00:00:42,730
board and we're going to build ourselves another view controller.

8
00:00:42,730 --> 00:00:49,270
So go ahead and search for you you controller and let's drag it on like so.

9
00:00:49,450 --> 00:00:50,770
That looks pretty good.

10
00:00:51,250 --> 00:00:52,670
And here's what we're going to do.

11
00:00:52,720 --> 00:01:00,040
We are going to go ahead and copy this UI navigation style controller and pasted it over here.

12
00:01:00,040 --> 00:01:06,220
We are going to go ahead and pin it from the left top and right zero.

13
00:01:06,490 --> 00:01:09,420
And it already has a height constraint so we're good to go.

14
00:01:09,760 --> 00:01:15,010
Next on this button we're going to right click and we're going to remove the Iby action that we set

15
00:01:15,070 --> 00:01:16,360
in the previous controller.

16
00:01:16,360 --> 00:01:19,880
And now this fully belongs to this view controller.

17
00:01:20,230 --> 00:01:25,600
So let's go ahead and let's build this out first then we're going to create the code subclass and then

18
00:01:25,600 --> 00:01:28,790
we're going to link up all of the Iby outlets and Iby actions.

19
00:01:28,900 --> 00:01:29,410
OK.

20
00:01:29,770 --> 00:01:33,820
So let's go ahead and let's put on a label.

21
00:01:34,090 --> 00:01:40,930
We're going to drag it and put it right here and I'm going to make it so that it goes about about there.

22
00:01:40,930 --> 00:01:42,270
That looks pretty good.

23
00:01:42,670 --> 00:01:49,030
And let's go into the attributes inspector let's center the text here and let's change the font to custom

24
00:01:49,570 --> 00:01:51,690
and the family to Avenir next.

25
00:01:51,790 --> 00:01:53,350
OK that looks pretty great.

26
00:01:53,350 --> 00:01:55,870
And let's make it a size 18.

27
00:01:55,870 --> 00:02:01,590
Next we're going to go ahead and this or that it says how many points until complete.

28
00:02:01,990 --> 00:02:02,950
And that looks good.

29
00:02:03,120 --> 00:02:03,330
OK.

30
00:02:03,340 --> 00:02:07,270
Let's pin that in place like so by pinning it.

31
00:02:07,330 --> 00:02:11,260
Let's think let's do 20 20 and 20.

32
00:02:11,260 --> 00:02:12,830
From the left top and right.

33
00:02:12,850 --> 00:02:15,660
And let's give it a fixed height of 25.

34
00:02:15,700 --> 00:02:18,870
Add those constraints and that will now stay in place.

35
00:02:18,880 --> 00:02:25,260
Next we're going to go ahead and give it a UI textfield and yeah drag that on right there.

36
00:02:25,270 --> 00:02:26,690
That looks awesome.

37
00:02:26,710 --> 00:02:32,360
And for this one what we're going to do is we're going to set placeholder text of 0 K and we're going

38
00:02:32,360 --> 00:02:37,670
to go ahead and center that and we're going to change this to be Avenir next.

39
00:02:37,990 --> 00:02:44,400
Like so we're going to set it to be bold and we're going to make this size 36 actually you know what

40
00:02:44,410 --> 00:02:46,580
let's make it even bigger 48.

41
00:02:46,630 --> 00:02:48,720
No that's still too small maybe.

42
00:02:48,880 --> 00:02:51,080
Dare I say 54.

43
00:02:51,310 --> 00:02:52,040
Wow.

44
00:02:52,270 --> 00:02:52,680
OK.

45
00:02:52,750 --> 00:02:53,200
Awesome.

46
00:02:53,200 --> 00:02:54,580
So that looks great.

47
00:02:54,670 --> 00:03:02,570
But now we need to do is to change the font color to our dark green which is 6 DBC 6 3.

48
00:03:02,590 --> 00:03:05,270
In case you're wondering so are placeholders Gray.

49
00:03:05,290 --> 00:03:11,380
Our text is green but we need to fix the height of this so that it actually is the proper height which

50
00:03:11,380 --> 00:03:12,170
it's not.

51
00:03:12,250 --> 00:03:15,460
So to do that we need to put it into a stack view with our label.

52
00:03:15,460 --> 00:03:20,110
So go ahead and click stack and I guess we didn't need to do those constraints until right now but that's

53
00:03:20,110 --> 00:03:21,080
fine.

54
00:03:21,100 --> 00:03:27,250
So go ahead and center that then click pin and we're going to pin 20 from the top 20 from the left and

55
00:03:27,250 --> 00:03:30,640
20 from the right and we're going to give it a.

56
00:03:30,910 --> 00:03:32,710
Well let's not give it a height constraint.

57
00:03:32,800 --> 00:03:37,780
We don't need to but we do need to give it some space because it's a little bit cramped here.

58
00:03:37,780 --> 00:03:38,760
So let's give it.

59
00:03:38,770 --> 00:03:41,250
How about 10 points of space.

60
00:03:41,350 --> 00:03:42,460
That looks pretty good.

61
00:03:42,880 --> 00:03:43,130
All right.

62
00:03:43,150 --> 00:03:43,540
Awesome.

63
00:03:43,540 --> 00:03:49,630
So now we're actually going to duplicate this button by selecting it and then pressing commands see.

64
00:03:49,870 --> 00:03:54,130
And we're going to click here on this view controller and press command V to paste it in.

65
00:03:54,130 --> 00:04:01,580
That looks awesome but we need to right click and we need to remove this action that's connected to

66
00:04:01,580 --> 00:04:02,560
create V-6.

67
00:04:02,570 --> 00:04:07,760
We don't want that and we want to change this to say create goal.

68
00:04:08,460 --> 00:04:09,380
All right.

69
00:04:09,380 --> 00:04:14,060
Because once we enter in the goal description choose long term or short term and turn the amount of

70
00:04:14,060 --> 00:04:20,960
points we have everything we need to create a goal supercool So now at this point we can go ahead and

71
00:04:20,960 --> 00:04:24,980
set up some Iby actions but we need a subclass file before we can do that.

72
00:04:24,980 --> 00:04:32,450
So right click on controller click new file Cocco touch class and we're going to call this finish goal

73
00:04:32,540 --> 00:04:35,540
Visi and go ahead and create it.

74
00:04:35,540 --> 00:04:40,280
Make sure the target is selected and add it into the controller group.

75
00:04:40,310 --> 00:04:40,870
Supercool.

76
00:04:40,940 --> 00:04:41,780
All right get rid of this.

77
00:04:41,780 --> 00:04:42,470
We don't need.

78
00:04:42,470 --> 00:04:43,870
Did receive memory warning.

79
00:04:44,210 --> 00:04:46,720
And we also don't need this comment and extra space.

80
00:04:46,730 --> 00:04:53,830
But now we need to go to main storyboard and set this controller to have the identity finish goals AVC.

81
00:04:53,930 --> 00:05:02,030
So go ahead and in the class go ahead and type finish goal VC just like that and then open the assistant

82
00:05:02,030 --> 00:05:06,170
editor so that we can link up the IB actions and Iby outlets.

83
00:05:06,170 --> 00:05:07,030
All righty.

84
00:05:07,400 --> 00:05:14,270
So select this view controller go to automatic and select finish goal Visi then what we need to do is

85
00:05:14,270 --> 00:05:18,720
we need to go ahead and we're going to create an action for this button.

86
00:05:18,770 --> 00:05:20,010
Create goal.

87
00:05:20,060 --> 00:05:26,540
So we're going to say create goal button was pressed and I'm moving a little faster here because we've

88
00:05:26,540 --> 00:05:28,480
already done this on quite a few VCs.

89
00:05:28,940 --> 00:05:33,110
So let's do an outlet for this because we're going to need to bind it to the keyboard just like the

90
00:05:33,110 --> 00:05:33,770
next button.

91
00:05:33,770 --> 00:05:34,700
And the other controller.

92
00:05:34,700 --> 00:05:38,660
So we'll just call this create goal button.

93
00:05:38,660 --> 00:05:39,990
All right.

94
00:05:40,520 --> 00:05:45,770
Next we need to go ahead and create an action for the I mean an outlet for this.

95
00:05:45,770 --> 00:05:49,620
I'm going to call this maybe points textfield.

96
00:05:50,020 --> 00:05:51,040
Super cool.

97
00:05:51,050 --> 00:05:52,500
That's great.

98
00:05:52,610 --> 00:05:55,150
And yeah that looks pretty good.

99
00:05:55,190 --> 00:06:02,480
So I think what we're going to need to do is we're going to first need to bind the Create Go button

100
00:06:02,480 --> 00:06:03,100
to the keyboard.

101
00:06:03,110 --> 00:06:08,990
So go ahead and type create Go button bind to keyboard and then when this is pressed this is where we're

102
00:06:08,990 --> 00:06:16,330
going to pass data into the core data gold model.

103
00:06:17,150 --> 00:06:23,700
What we need to do now is to initialize data whenever we create this finished goal VC.

104
00:06:23,780 --> 00:06:28,280
We need to initialize data and pass it into this view controller from the beginning so that we can pass

105
00:06:28,370 --> 00:06:32,540
all of it when complete into this function when we create our goal.

106
00:06:32,840 --> 00:06:39,710
So what we're going to do is we're going to go into finished goal AVC which we're already in and we

107
00:06:39,710 --> 00:06:43,830
need to create a function called enet data in.

108
00:06:44,250 --> 00:06:53,630
And in it data is basically going to take in a description from this text view and a goal type short

109
00:06:53,630 --> 00:07:05,220
term or long term so we can just type in data description of type string and a type of goal type.

110
00:07:05,390 --> 00:07:05,690
All right.

111
00:07:05,690 --> 00:07:06,790
That looks great.

112
00:07:06,860 --> 00:07:11,990
But now we need to do is we need to create some variables that are in this view controller that we're

113
00:07:11,990 --> 00:07:16,790
not actually going to display their data on this screen anywhere but we're going to use these variables

114
00:07:16,790 --> 00:07:23,870
to hold the values so that later we can pass them into the function that basically saves this model

115
00:07:23,930 --> 00:07:25,620
into our core data model.

116
00:07:25,640 --> 00:07:29,710
So we need a variable to hold the description and to hold the gold type.

117
00:07:29,710 --> 00:07:40,780
So go ahead and type var goal description of type string and var goal type of type type type call type.

118
00:07:40,790 --> 00:07:41,110
All right.

119
00:07:41,120 --> 00:07:41,790
So cool.

120
00:07:41,810 --> 00:07:46,140
We're going to go ahead and initialize these values by typing self doggle description.

121
00:07:46,280 --> 00:07:50,630
That variable we just made up there and we're going to set its value to be in the description we pass

122
00:07:50,630 --> 00:07:52,880
in when we create this view controller.

123
00:07:52,880 --> 00:08:00,110
Next we're going to set self-growth type to be equal to the type we pass in and that's that once we

124
00:08:00,110 --> 00:08:06,110
instantiate this view controller we will be able to call this and pass in the values and set them for

125
00:08:06,110 --> 00:08:07,160
later.

126
00:08:07,160 --> 00:08:14,120
So in order to actually pass these though we have to go back to create goal Visi like so and we're going

127
00:08:14,120 --> 00:08:19,090
to set up how we actually instantiate this properly and initialize the data.

128
00:08:19,130 --> 00:08:24,740
So when we press the next button that's when it's going to happen that's when we're going to initialize

129
00:08:24,740 --> 00:08:28,590
the data that's when we're going to present the next to the seat.

130
00:08:28,730 --> 00:08:30,740
So here's what going to happen.

131
00:08:30,740 --> 00:08:35,150
We're going to go ahead and we need to set some conditions we need to first make sure that our goal

132
00:08:35,150 --> 00:08:37,260
text view has even been entered into.

133
00:08:37,460 --> 00:08:49,190
So go ahead and type if goal text view text is not equal to nothing and goal text view dot text is not

134
00:08:49,250 --> 00:08:53,090
equal to what is your goal.

135
00:08:53,090 --> 00:08:55,680
Because remember we're not using a placeholder.

136
00:08:55,700 --> 00:08:57,950
We're actually using text in the text view.

137
00:08:58,040 --> 00:09:00,150
And when we tap it we're going to clear it out.

138
00:09:00,290 --> 00:09:02,060
We haven't done that yet but we're going to.

139
00:09:02,240 --> 00:09:06,290
So we're going to just make sure that it's not what is your goal because that's not a goal and we're

140
00:09:06,290 --> 00:09:08,650
going to make sure that there is something typed in there.

141
00:09:08,780 --> 00:09:09,800
OK.

142
00:09:09,800 --> 00:09:14,090
Now in order to present this view controller we're going to do it the same way that we did in Goles

143
00:09:14,090 --> 00:09:15,010
VC.

144
00:09:15,080 --> 00:09:18,510
We created an instance using the storyboard and we presented it.

145
00:09:18,590 --> 00:09:19,250
OK.

146
00:09:19,640 --> 00:09:22,820
So what we're going to do is the same thing.

147
00:09:22,850 --> 00:09:25,880
Guard let finish goal.

148
00:09:25,880 --> 00:09:30,960
The C equals storyboard whip's lowercase storyboard.

149
00:09:31,070 --> 00:09:38,000
Instantiate controller with identifier and that identifier is finish goal visi.

150
00:09:38,240 --> 00:09:41,350
But we have not yet actually set this that will cause a crash.

151
00:09:41,360 --> 00:09:47,780
So go ahead and tap maned storyboard and select this view controller select the identity inspector and

152
00:09:48,020 --> 00:09:49,040
storyboard ID.

153
00:09:49,030 --> 00:09:52,080
We're going to type finish goal you see.

154
00:09:52,520 --> 00:09:55,000
Now we can properly access it from create goal.

155
00:09:55,190 --> 00:09:55,870
OK.

156
00:09:56,180 --> 00:09:58,100
So we are now instantiating this.

157
00:09:58,100 --> 00:10:01,290
But if we can't for some reason we're just going to return.

158
00:10:01,760 --> 00:10:02,450
OK.

159
00:10:02,690 --> 00:10:03,600
So supercool.

160
00:10:03,620 --> 00:10:07,120
Now before we present this though this is where we initialize the data.

161
00:10:07,160 --> 00:10:10,690
So go ahead and type finish go visi.

162
00:10:10,820 --> 00:10:16,730
In its data and it looks like that function is not yet showing because we have not actually cast this

163
00:10:17,000 --> 00:10:18,650
as the proper type finish goal.

164
00:10:18,650 --> 00:10:19,840
VC.

165
00:10:19,930 --> 00:10:26,140
So instantiate it and cast it as a finished goal VC and now we should be able to access it data.

166
00:10:26,150 --> 00:10:33,560
So the description is going to be from gold text view text and since its a text view its text property

167
00:10:33,560 --> 00:10:35,750
is optional so we need to force unwrap it.

168
00:10:35,900 --> 00:10:40,010
But we know thats fine because weve already checked to make sure that it has text.

169
00:10:40,010 --> 00:10:44,320
And of course the gold type is going to be whatever gold type we have set.

170
00:10:44,520 --> 00:10:45,110
OK.

171
00:10:45,350 --> 00:10:50,900
Remember we have a variable here keeping track of that and its always going to have a value because

172
00:10:50,960 --> 00:10:53,990
we instantiate it from the get go with a value.

173
00:10:53,990 --> 00:10:55,160
So we're good to go.

174
00:10:55,460 --> 00:10:58,170
So we have now initialized the data.

175
00:10:58,190 --> 00:11:03,730
Now all we need to do is type present detail and pass and finish goal.

176
00:11:03,730 --> 00:11:07,330
VC when I go try it out I do.

177
00:11:07,460 --> 00:11:09,290
Let's do it build and run.

178
00:11:09,290 --> 00:11:15,140
I just press command our and your simulator should pop up and we should be able to check this out.

179
00:11:15,140 --> 00:11:18,250
So let's press next or add.

180
00:11:18,260 --> 00:11:20,750
I mean let's go ahead and create a go.

181
00:11:20,960 --> 00:11:24,060
Eat healthy.

182
00:11:25,310 --> 00:11:32,660
Eat healthy food can't type food twice a day.

183
00:11:32,750 --> 00:11:33,310
All right.

184
00:11:33,310 --> 00:11:36,600
And I'm going to make that a long term goal press next.

185
00:11:36,860 --> 00:11:37,420
Ooh.

186
00:11:37,520 --> 00:11:40,980
We have a problem we did not set constraints for our button.

187
00:11:41,030 --> 00:11:46,510
So how many points until complete let's say maybe for five days.

188
00:11:46,610 --> 00:11:48,580
Weird thing the font change there as well.

189
00:11:48,590 --> 00:11:50,660
So it looks like we have some work to do.

190
00:11:50,690 --> 00:11:57,950
Let's go back to our storyboard really fast and let's create our goal here or let's pin this button

191
00:11:57,950 --> 00:11:58,670
to the bottom.

192
00:11:58,670 --> 00:12:02,180
So go ahead and pin zero from the left bottom and right.

193
00:12:02,510 --> 00:12:07,460
And it already has a height constraint carrying over from the previous view controller so just add those

194
00:12:07,460 --> 00:12:11,900
three constraints and this textfield is where we're having some trouble here.

195
00:12:11,930 --> 00:12:19,730
Now we are doing fine but we're going to go ahead and remove the border and we're going to go ahead

196
00:12:20,240 --> 00:12:23,010
and just make sure that our front here is good.

197
00:12:23,060 --> 00:12:27,930
You know we've set a font we've set it size and that looks good.

198
00:12:28,220 --> 00:12:28,940
OK.

199
00:12:29,180 --> 00:12:32,290
So let's let's just make sure that this stays the same size.

200
00:12:32,290 --> 00:12:38,570
By giving it a height constraint I didn't want to but I'm actually going to let's just do 110 press

201
00:12:38,570 --> 00:12:41,020
enter and now go ahead and build and run.

202
00:12:41,330 --> 00:12:44,520
And let's see if everything is in its proper place.

203
00:12:47,430 --> 00:12:49,360
OK press and what is your goal.

204
00:12:49,370 --> 00:12:50,350
Oh you know what let's check.

205
00:12:50,350 --> 00:12:51,700
We set a condition.

206
00:12:51,900 --> 00:12:54,460
OK so if it says what is your goal or if it's empty.

207
00:12:54,530 --> 00:12:55,850
It doesn't work.

208
00:12:55,850 --> 00:13:01,590
Eat healthy eat healthy food twice a day.

209
00:13:01,910 --> 00:13:04,050
Long term goal.

210
00:13:04,300 --> 00:13:05,550
This list looks way better.

211
00:13:05,570 --> 00:13:11,220
OK how many points still complete let's say for high and you see how it's changing the size there.

212
00:13:11,410 --> 00:13:11,600
OK.

213
00:13:11,600 --> 00:13:12,230
That's really weird.

214
00:13:12,230 --> 00:13:20,300
So it appears that we do not have total control over this view controller but we need to go ahead and

215
00:13:20,300 --> 00:13:21,980
figure out why that is.

216
00:13:22,130 --> 00:13:27,920
We have not let's see oh you know what we have not yet inherited from you I textfield delegates so let's

217
00:13:27,920 --> 00:13:29,110
do that really quick.

218
00:13:29,240 --> 00:13:31,670
UI textfield delegate.

219
00:13:32,150 --> 00:13:36,890
And let's go ahead and let's just set up in view did load.

220
00:13:36,980 --> 00:13:40,220
Let's go ahead and make the delegate of our textfield this view controller.

221
00:13:40,220 --> 00:13:45,110
So go ahead and type points textfield delegate equals self.

222
00:13:45,110 --> 00:13:48,650
And when we build and run we should be able to set the delegate here.

223
00:13:48,650 --> 00:13:49,530
Awesome.

224
00:13:49,610 --> 00:13:53,620
And you know while we're at it we should also do this in create gold visi.

225
00:13:53,900 --> 00:13:59,870
So let's go ahead and do that by typing UI text view delegate remembering that goal text view is a text

226
00:13:59,870 --> 00:14:01,690
view not a text field.

227
00:14:01,700 --> 00:14:07,460
And what we're going to do is we're actually going to clear out the text view when we start editing

228
00:14:07,460 --> 00:14:07,890
it.

229
00:14:07,910 --> 00:14:15,410
So to do that we can actually access one of the text views functions and it's called Text view did begin

230
00:14:15,470 --> 00:14:16,340
editing.

231
00:14:16,730 --> 00:14:22,370
So if we enter into that text you and it starts editing we're going to set goal text you don't text

232
00:14:22,370 --> 00:14:23,900
to be equal to nothing.

233
00:14:23,930 --> 00:14:29,840
We're going to clear it out just like a placeholder and we're going to set goal text for you dot text

234
00:14:29,870 --> 00:14:34,680
color to be equal to a color literal of black.

235
00:14:34,700 --> 00:14:38,500
So select the color literal there and select black.

236
00:14:38,510 --> 00:14:43,370
Now we can build and run and whoops you know what we did not set the delegate I just built and run.

237
00:14:43,370 --> 00:14:45,850
But we're going to set go text for you.

238
00:14:46,640 --> 00:14:47,320
There we go.

239
00:14:47,360 --> 00:14:49,710
Delegate to self.

240
00:14:49,730 --> 00:14:50,730
Now I'm going to build and run.

241
00:14:50,780 --> 00:14:55,800
I just pressed commander and now we should be able to go in and properly commend this.

242
00:14:55,800 --> 00:14:58,040
So what is your goal.

243
00:14:58,130 --> 00:14:59,450
And it clears that beautiful.

244
00:14:59,480 --> 00:15:02,460
Oh but we good case our button works.

245
00:15:02,540 --> 00:15:05,010
It's cleared and we can't send anything.

246
00:15:05,190 --> 00:15:06,080
Eat Whoops.

247
00:15:06,230 --> 00:15:08,840
Eat healthy food.

248
00:15:09,380 --> 00:15:11,230
Twice a week.

249
00:15:11,270 --> 00:15:12,280
Awesome.

250
00:15:12,410 --> 00:15:15,050
Next how many points to complete.

251
00:15:15,050 --> 00:15:18,380
We're going to say five.

252
00:15:18,620 --> 00:15:25,170
And so it appears that the font is still changing size on us and we don't want that.

253
00:15:25,330 --> 00:15:30,040
So let's go ahead and go into our story board here and let's figure out what the problem is the alignment

254
00:15:30,070 --> 00:15:31,470
is center.

255
00:15:31,660 --> 00:15:33,160
We actually want it to be fill.

256
00:15:33,280 --> 00:15:37,210
So I don't think that's the problem but that could be part of it.

257
00:15:37,270 --> 00:15:41,870
We have a minimum font size.

258
00:15:41,880 --> 00:15:47,860
So let's turn off just to fit for the font size and for the keyboard type actually when we go into here

259
00:15:47,860 --> 00:15:51,940
we can put in text and that does not make sense for our application.

260
00:15:51,940 --> 00:15:56,290
So let's go ahead and set the keyboard type to actually just be number pad because we don't need it

261
00:15:56,290 --> 00:15:57,720
to be text data.

262
00:15:57,770 --> 00:15:57,990
OK.

263
00:15:58,000 --> 00:15:59,800
That will actually cause problems with our application.

264
00:15:59,800 --> 00:16:06,550
So build and run one more time let's go see if that fixed our problem with our weird font size issues

265
00:16:07,300 --> 00:16:10,740
and we should be able to call this video good to go.

266
00:16:11,140 --> 00:16:13,520
OK so let's go ahead and create a goal here.

267
00:16:13,740 --> 00:16:16,360
Eat healthy

268
00:16:19,300 --> 00:16:21,840
lunches for two days.

269
00:16:21,940 --> 00:16:29,230
Short term goal and a let's see OK the button slides we have a number pad and two days oh Sarah button

270
00:16:29,440 --> 00:16:30,830
our button goes away there.

271
00:16:30,880 --> 00:16:32,890
That is not what we want.

272
00:16:32,980 --> 00:16:39,610
So I think we're going to have to do actually to make this work is I think this is an issue with the

273
00:16:40,250 --> 00:16:44,500
super view and the frame of the whole view controller so in order to fix this we're actually going to

274
00:16:44,500 --> 00:16:51,940
go ahead and bring in a view like so and let's just drag it in like this.

275
00:16:51,940 --> 00:16:58,990
And you know what I found this issue when you actually use the constraints of the safe area in beta

276
00:16:58,990 --> 00:17:06,180
4 or the Superville whenever you enter text it's some for some reason updates the frame and the constraints

277
00:17:06,190 --> 00:17:08,170
pull back down to where it's supposed to be.

278
00:17:08,170 --> 00:17:14,170
So in order to circumvent this I actually have found that it works if you put this inside of a UI view

279
00:17:14,470 --> 00:17:19,240
that is on top of the current view and then basically pin the constraints to this view instead of the

280
00:17:19,240 --> 00:17:22,870
super view because then the outside constraints don't change.

281
00:17:22,870 --> 00:17:28,600
So we're going to actually drop our create Go button into this view and we're going to drag that all

282
00:17:28,600 --> 00:17:29,890
the way down to the bottom.

283
00:17:30,090 --> 00:17:32,650
OK and we're going to also adjust this.

284
00:17:32,800 --> 00:17:35,050
So the view that we just created.

285
00:17:35,050 --> 00:17:39,580
Let's go ahead and pin this eight from the top zero from the right zero from the bottom and zero from

286
00:17:39,580 --> 00:17:40,540
the left.

287
00:17:40,600 --> 00:17:46,900
Add those constraints and now we can pin this button zero from the left bottom and right and add those

288
00:17:46,900 --> 00:17:47,490
constraints.

289
00:17:47,500 --> 00:17:48,260
Now it's white.

290
00:17:48,280 --> 00:17:50,430
So it's going to blend in with the background and that's fine.

291
00:17:50,440 --> 00:17:55,630
So let's go see if this fixed our problem and then we'll move on to the next video.

292
00:17:55,690 --> 00:17:57,310
So we're building and running.

293
00:17:57,490 --> 00:17:59,170
And here we go.

294
00:17:59,500 --> 00:18:01,290
Loading up.

295
00:18:02,140 --> 00:18:04,200
Eat healthy food.

296
00:18:04,210 --> 00:18:06,320
Twice a week.

297
00:18:06,550 --> 00:18:09,240
I love how it started with twice a day and now it's twice a week.

298
00:18:09,280 --> 00:18:09,590
OK.

299
00:18:09,610 --> 00:18:11,170
So how many points until complete.

300
00:18:11,170 --> 00:18:14,950
We're going to say two points and notice our button doesn't go anywhere.

301
00:18:14,950 --> 00:18:15,490
Perfect.

302
00:18:15,490 --> 00:18:16,830
That's exactly what we want.

303
00:18:17,050 --> 00:18:22,780
And now create gold is going to be the button that's going to save our data into our persistent store

304
00:18:23,140 --> 00:18:24,810
and we're going to do that in the next video.

305
00:18:24,880 --> 00:18:29,740
But we're going to basically save it then we'll dismiss this view controller and we're going to go ahead

306
00:18:29,770 --> 00:18:32,530
and show it in the table view very very soon.

307
00:18:32,530 --> 00:18:33,610
It's very exciting.

308
00:18:33,610 --> 00:18:37,570
So amazing work building out this amazing view controller.

309
00:18:37,570 --> 00:18:39,790
We're almost done guys we're on our way.

310
00:18:39,790 --> 00:18:44,920
Next we're going to go ahead and write a function to save our data into our persistent store using core

311
00:18:44,920 --> 00:18:45,650
data.

312
00:18:45,910 --> 00:18:50,830
Then we're going to write a function to fetch all that data and fill an array full of goals and then

313
00:18:50,830 --> 00:18:54,250
we're going to fill our table view with that we're so close I can't even believe it.

314
00:18:54,250 --> 00:18:58,180
So awesome awesome job guys all see it in the next video.

315
00:18:58,180 --> 00:18:59,370
Let's head over there now.
