So it will come back again.
This lesson essentially the next few lessons will deal with flipping the tide and revealing what's behind
it and then making a decision on that basis.
So the very first step and this is at the very beginning of the game is when we stop on a tile that
one should flip itself and reveal what's the value behind it.
Now let's do that in this lesson.
I'm going to go to this school and when I write a new file I'm going to call it let's say View Controller
plus flip to reveal because it's the very first one that can be Taplin an item that one flips and reveals
what's behind it.
So to do that I'm going to go ahead and say I have a again the same thing as before and this is an extension
to view controller.
And then when I have a function and that function I'm going to call it flip to reveal And the flip to
reveal is going to ask for an input to that view and that the value is reached while you want to reveal.
So I'm going to say that's called Impe.
Title of the type my label of course doesn't return anything.
And here is the body of the function you I view the transition and the transition is to view.
And again this is something we have seen if you are taking this as a part of the U.S. boot camp.
Otherwise this is a transition that essentially takes a view and within a certain duration flips it
or does one of the many animation options in this case.
I'm going to use a flip.
So it's called Philip let's say from left.
And if they want to do this on is actually the input and the time I want to do this let's say it's point
five seconds.
The animation that they want to have they will see then as I can I don't have any completions.
Now the animation is they want to see during this flip action or the flip transition is a few things
one of them is time.
Want him to have a different background color.
Let's say a green color.
And also I want the entire text to show the value that is holding its internal numbers.
So it's going to be infantine dot internal number.
So that should essentially give us a green back on tile with a text over that internal number of that
type and the internal number is an optional value.
I'm going to go ahead and make it a forced one wrapped one.
Let me form out all of these and make it nice and tidy.
Another They have that the next thing they need to do is I need to call this one every time I touch
on a tile.
So I'm going to put the touches and that and in yeah I'm going to say if the top tied was the right
one do this flip to reveal a tapped type.
So let's see if that's going to work.
I'm going to tell you that something will not work the way we expected but I want to see it first and
then I'm going explain how we can fix it.
The thing that won't work is this text the value of the title because the values are already being shown.
So the 5 is already shown and the 7 is shown but then I press 5 it flips becomes green and shows 5 once
again.
Same thing with seven.
A thing with Sikh's so on and so forth.
And to fix that I'm going to have to go to all my major tiles I need to make tiles very make every tide
and everything is working and we have the right counter value placed inside the internal number.
I'm going to say don't show it in the title text.
Instead do this say every time the text becomes my label dodged the question mark and that is the reason
why we had that question.
If you remember quite a few lessons ago we had in the my label we had the question that was a question
mark and that's the reason I had that there you could obviously go in here and say well this is just
a question mark such as that one or you could use a static value question.
And the reason I like to use this one is if I run the OP now we will see the question mark and that's
something we expect.
And I'm going to show you why I wanted to use the question mark and I'm going to change it to.
Now we see the question why.
We top it shows us two.
This one shows us five.
I could actually go ahead in here and say instead of a alphabetical order out of a numerical question
mark show me a different one that searched for a question mark.
I don't know if there is one sure there is quite a few of them.
So maybe show me this one that's a little bit different.
So it's actually an emoji question mark or some sort of a graphical question like.
In any case having it as a static value helps me change all of them whenever I want to.
Now that's not and that's that.
So so far this and we manage to use the Philipe to reveal to successfully flip one of our tiles and
show it's internal number and turn the colors green.
So let's see what comes next.