1 00:00:00,660 --> 00:00:06,260 Come back again this lesson is going to be very important and yet very simple and this listen we're 2 00:00:06,270 --> 00:00:12,300 going to find the interactions that the user does with the time is now the beginning of this interaction 3 00:00:12,300 --> 00:00:16,260 which is what we'll be doing in this lesson is actually very very simple. 4 00:00:16,370 --> 00:00:22,860 But as the time passes and we add more functionalities to this game I will be changing stuff in dysfunction 5 00:00:22,860 --> 00:00:23,470 as well. 6 00:00:23,610 --> 00:00:28,680 So if the school had to and an index card I'm actually going to go ahead and make your file. 7 00:00:28,920 --> 00:00:35,130 I'm going to call it View Controller plus touches. 8 00:00:35,190 --> 00:00:41,390 And so you control the plus touches and that is the file that is going to take care of or touches and 9 00:00:41,390 --> 00:00:45,390 that function and subsequently the interactions with the tiles. 10 00:00:45,390 --> 00:00:47,180 I'm going to go ahead into that fine. 11 00:00:47,190 --> 00:00:50,670 Say I need to import the UI kit. 12 00:00:50,670 --> 00:00:57,670 This is an extension to your controller and within it I have only one function called touches. 13 00:00:57,690 --> 00:01:05,160 And now if you're not familiar with that and that this is a part of the UI kit that tackles any interaction 14 00:01:05,160 --> 00:01:11,100 that the user causes with the interface you could very well do that with a top gesture recognizer. 15 00:01:11,100 --> 00:01:16,530 I choose to use the touch isn't that because I think it gives me more control over what I want to do. 16 00:01:16,770 --> 00:01:18,370 So here are the things that I wanted. 17 00:01:18,420 --> 00:01:20,350 First of all I want to get my touch. 18 00:01:20,610 --> 00:01:26,730 I'm going to say Let my touch be touch as Dot first and that's going to be a touch. 19 00:01:26,880 --> 00:01:30,210 And my assumption is that there is only one touch landing. 20 00:01:30,210 --> 00:01:32,890 That's why I'm getting the very first one. 21 00:01:33,000 --> 00:01:35,220 If you want you can actually check for that. 22 00:01:35,220 --> 00:01:41,380 You can see if touches count was larger than one in return or do something like that. 23 00:01:41,460 --> 00:01:45,220 But for now I'm going to go ahead and say the next thing I want to do is this. 24 00:01:45,390 --> 00:01:46,670 And that's the part that they said. 25 00:01:46,680 --> 00:01:48,100 It's very simple in here. 26 00:01:48,240 --> 00:01:53,390 All I want to do is I want to print the internal number of any of my labels. 27 00:01:53,520 --> 00:01:54,470 So let's do it. 28 00:01:54,480 --> 00:01:59,510 I'm going to set you flat Let's call this one tap tight. 29 00:01:59,850 --> 00:02:08,190 If there is going to be my touch down to view and I'm going to get it as my label if I have tapped on 30 00:02:08,190 --> 00:02:13,430 something that is off the top of my label let me repeat that because that's very important. 31 00:02:13,620 --> 00:02:19,710 I have touched some and the interface is touch could be anywhere could be on the timer label it could 32 00:02:19,710 --> 00:02:27,150 be on the you won't label but I'm saying if it was of the type my label it means do this. 33 00:02:27,210 --> 00:02:34,200 Only if I have tab on one of these many times which is a very good way for checking the type of objects 34 00:02:34,200 --> 00:02:36,520 that you want to be able to interact with. 35 00:02:36,660 --> 00:02:40,710 So I'm saying if it was of the type label here is what they wanted to do. 36 00:02:40,710 --> 00:02:52,050 Just print and say let's say this title is number and then I'm going to say give me tap. 37 00:02:52,110 --> 00:03:00,130 Tyler Dodd internal numbers internal number and that's all I have to do to get that. 38 00:03:00,240 --> 00:03:04,720 You now excludes giving me a warning saying internal number is an optional value. 39 00:03:04,740 --> 00:03:07,750 So I'm actually going to say force on rapide. 40 00:03:07,790 --> 00:03:14,250 I know the value actually exists because I have defined the values for them when I was creating my tiles. 41 00:03:14,520 --> 00:03:20,280 Now before I run the test of the app I have to show you something else I have to make sure that my tiles 42 00:03:20,280 --> 00:03:22,870 are actually user intractable. 43 00:03:23,050 --> 00:03:29,520 And we do that by going to all make tiles and in here I'm going to go ahead to that I make the tiles 44 00:03:29,880 --> 00:03:37,230 and I'm going to go ahead and say anywhere around here I'm going to say tile does use that interaction 45 00:03:37,430 --> 00:03:38,290 enabled. 46 00:03:38,310 --> 00:03:39,540 Is that true. 47 00:03:39,780 --> 00:03:45,360 So this you do it somebody in your make tiles to make sure that you're using interaction is enabled 48 00:03:45,630 --> 00:03:47,760 for each of these many times. 49 00:03:47,880 --> 00:03:50,430 Let's go ahead and run the app and if it all goes well. 50 00:03:50,550 --> 00:03:57,250 Now when we tap on any of the toys I should be able to see that internal number but anywhere else I 51 00:03:57,250 --> 00:03:58,710 shouldn't get anything. 52 00:03:58,890 --> 00:04:00,720 So let me clear my console. 53 00:04:00,780 --> 00:04:04,160 Now I said in town number is 3 1 6. 54 00:04:04,210 --> 00:04:05,550 When I type anywhere else. 55 00:04:05,550 --> 00:04:07,440 It doesn't actually do anything for me. 56 00:04:07,440 --> 00:04:14,190 It only does it when I tap on the tiles and that's all I had to do in this lesson and I had to make 57 00:04:14,190 --> 00:04:20,760 sure that my touches and that is successfully working only on the labels and our internal numbers are 58 00:04:20,760 --> 00:04:21,550 correct. 59 00:04:21,690 --> 00:04:24,090 With that in mind I'm going to move on to our next lesson.