1 00:00:00,830 --> 00:00:02,719 Okay. Now, we want to connect up our 2 00:00:02,719 --> 00:00:04,930 button the way we did for the label. 3 00:00:04,930 --> 00:00:08,640 First, let's make a little room for the button by moving this label up a bit. 4 00:00:08,640 --> 00:00:12,039 And, we'll need to open up our utilities pane, so we can drag in the button. 5 00:00:15,270 --> 00:00:16,930 There we go. 6 00:00:16,930 --> 00:00:20,680 While we have this utilities pane on the right open, let's go ahead and 7 00:00:20,680 --> 00:00:23,770 set the titles on this button and label. 8 00:00:23,770 --> 00:00:27,910 To do that, you're going to want to go to the attributes inspector, and 9 00:00:27,910 --> 00:00:30,460 then you can see, here's where our title gets set. 10 00:00:31,730 --> 00:00:32,670 We'll just say Click. 11 00:00:33,870 --> 00:00:38,450 And then, for the label, let's just set it's original text to zero. 12 00:00:38,450 --> 00:00:43,440 Let's close our utilities pane for now and move this back to the center. 13 00:00:43,440 --> 00:00:46,730 And next up, we're going to set target action on this button. 14 00:00:46,730 --> 00:00:49,380 First up, let's open up our view controller file for 15 00:00:49,380 --> 00:00:51,950 a little review on target action. 16 00:00:51,950 --> 00:00:55,060 Recall that the target action that we added programatically 17 00:00:55,060 --> 00:00:56,760 had three key components. 18 00:00:56,760 --> 00:01:01,890 Its target, which was self, the action, which was the method increment count, 19 00:01:01,890 --> 00:01:05,280 and the event that would trigger that action, touch up inside. 20 00:01:06,580 --> 00:01:09,240 So, now, we're going to use storyboard to tie together these 21 00:01:09,240 --> 00:01:10,920 same three pieces of information. 22 00:01:12,420 --> 00:01:15,320 But first, we need to mark this method as an IB action 23 00:01:15,320 --> 00:01:17,490 to that it actually shows up in story board. 24 00:01:19,030 --> 00:01:21,760 Similar to how we did with the label property. 25 00:01:23,160 --> 00:01:25,500 And, we can close our assistant editor for now and 26 00:01:25,500 --> 00:01:29,440 focus on story board, and then move this over a bit. 27 00:01:29,440 --> 00:01:34,260 And, to set our target action, first we bring up the button's 28 00:01:34,260 --> 00:01:37,680 pop up connections menu, go down to touch up inside, 29 00:01:37,680 --> 00:01:42,010 drag to our view controller, and choose the method we want our to be our action. 30 00:01:43,010 --> 00:01:45,730 I'm just going to remove that target action really quick, so 31 00:01:45,730 --> 00:01:48,570 I can show you how to make it one other way. 32 00:01:48,570 --> 00:01:52,410 Using the canvas view, you can still get to this menu. 33 00:01:52,410 --> 00:01:56,250 Go from touch up inside to the view controller, and 34 00:01:56,250 --> 00:01:58,370 then the method increment count. 35 00:01:58,370 --> 00:02:02,230 And, you can see the three key components of the target action. 36 00:02:02,230 --> 00:02:05,550 Let's go ahead and run it so we can see it in action. 37 00:02:05,550 --> 00:02:09,479 And if we click on the button, we can see our count incrementing. 38 00:02:09,479 --> 00:02:11,800 So, that ought to take care of click counter. 39 00:02:11,800 --> 00:02:14,790 Remember how our label had an optional type? 40 00:02:14,790 --> 00:02:15,590 Next up, 41 00:02:15,590 --> 00:02:19,200 Jason's going to tell you all about optionals in the first Swift session