Come back again this lesson is going to be very important and yet very simple and this listen we're
going to find the interactions that the user does with the time is now the beginning of this interaction
which is what we'll be doing in this lesson is actually very very simple.
But as the time passes and we add more functionalities to this game I will be changing stuff in dysfunction
as well.
So if the school had to and an index card I'm actually going to go ahead and make your file.
I'm going to call it View Controller plus touches.
And so you control the plus touches and that is the file that is going to take care of or touches and
that function and subsequently the interactions with the tiles.
I'm going to go ahead into that fine.
Say I need to import the UI kit.
This is an extension to your controller and within it I have only one function called touches.
And now if you're not familiar with that and that this is a part of the UI kit that tackles any interaction
that the user causes with the interface you could very well do that with a top gesture recognizer.
I choose to use the touch isn't that because I think it gives me more control over what I want to do.
So here are the things that I wanted.
First of all I want to get my touch.
I'm going to say Let my touch be touch as Dot first and that's going to be a touch.
And my assumption is that there is only one touch landing.
That's why I'm getting the very first one.
If you want you can actually check for that.
You can see if touches count was larger than one in return or do something like that.
But for now I'm going to go ahead and say the next thing I want to do is this.
And that's the part that they said.
It's very simple in here.
All I want to do is I want to print the internal number of any of my labels.
So let's do it.
I'm going to set you flat Let's call this one tap tight.
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
something that is off the top of my label let me repeat that because that's very important.
I have touched some and the interface is touch could be anywhere could be on the timer label it could
be on the you won't label but I'm saying if it was of the type my label it means do this.
Only if I have tab on one of these many times which is a very good way for checking the type of objects
that you want to be able to interact with.
So I'm saying if it was of the type label here is what they wanted to do.
Just print and say let's say this title is number and then I'm going to say give me tap.
Tyler Dodd internal numbers internal number and that's all I have to do to get that.
You now excludes giving me a warning saying internal number is an optional value.
So I'm actually going to say force on rapide.
I know the value actually exists because I have defined the values for them when I was creating my tiles.
Now before I run the test of the app I have to show you something else I have to make sure that my tiles
are actually user intractable.
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
and I'm going to go ahead and say anywhere around here I'm going to say tile does use that interaction
enabled.
Is that true.
So this you do it somebody in your make tiles to make sure that you're using interaction is enabled
for each of these many times.
Let's go ahead and run the app and if it all goes well.
Now when we tap on any of the toys I should be able to see that internal number but anywhere else I
shouldn't get anything.
So let me clear my console.
Now I said in town number is 3 1 6.
When I type anywhere else.
It doesn't actually do anything for me.
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
sure that my touches and that is successfully working only on the labels and our internal numbers are
correct.
With that in mind I'm going to move on to our next lesson.