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