So it will come back again.
In this listen we have to find a way to compare the two ties that we have just revealed.
Now before I go into the quote I should explain to you how you are planning to do this thing.
Let me go to the simulator.
Here is our situation.
I tap on one time that's one Philips and we see a number on it and this is not the time we have to compare.
It might happen another time and we see another number.
Now we have to compare them.
So why what they just said we have to infer a few things.
First of all we have to remember whether this is the time to compare or not.
Second thing we have to remember what we tapped on in the very first attempt and what we're tapping
on this time.
And then we have to reset this.
So once I got five on one that's a pair that's going to be compared against each other.
And now when I tap again and again these will have to be compared against one another.
So let's go ahead and quote them right.
All of that down.
I'm going to say give my view controller.
I have a few new valuables.
I have a valuable call first time.
That's going to be a my label.
I have a viable let's call it the second time.
That's also my label.
So these are the toys that we tap on.
One other time.
First one second one first one second one.
I just keeps going on like this.
Then I have a VAT and this one I'm going to call compare now and this is by default false because this
is the state of the game whether we should compare right now or not at the beginning.
We shouldn't compare.
Now we should compare.
Now we shouldn't compare again because we're getting another one.
Now we're comparing against five.
So we should come back.
Now let's see how are we going to change these values to reflect what I just suggested.
To do that I'm going to go ahead into a metal that we call touches in that nuthatches and that I have
to decide about a few things.
The most important one are these.
If I found a top high tide I have to find out that this is the first time or the second time.
So I'm going to go ahead and say if I can compare Now if this is the time to compare you have to do
something else you have to do other things.
And the other thing is that we have to do if we are comparing it means this is the second time we have
stopped.
And that means second time becomes top tied.
If this wasn't the case if we're in the else it means first time is tops tied.
So depending on which type of your on the day it is compare mode or not we decide about our two tiles.
Now we got the tile set up over there and then we have to do reveal for them.
So if this is the very first time we're doing this you should just reveal it which is the function we
already have.
If this is the second time we're doing it we have to review and compare.
And that's a function we don't have yet.
So let me go ahead and add that I'm going to say come on.
And this one I'm going to call the View Controller plus review and compare
your import you I can't I'm going to say this is an extension of you controller.
There is a function it's called reveal and compare and it does take just like the previous review.
It takes an input value.
So I'm going to call that exactly the same thing.
So it's easier for me.
And then I'm going to say within it we need another transition.
So you gave you that transition.
Now let's talk quickly about what's the difference between this one and the reveal that you had before
the previous one flip to reveal essentially makes an animation to reveal what's shown behind it.
And I could actually copy a lot of these things.
I could copy almost all of these.
Now we have to say do all of that once you're done with the animation and that is happening in the completion
block once you reach the completion block you should also do something here.
The last thing we didn't have anything happening in the completion to completion was nil.
This time we are doing something in the completion.
So I replaced all of that and in here in the completion BLOCK Let me add it that's a bit cleaner in
the completion.
I'm going to call the completion value of a raise even though it doesn't really matter.
I'm not going to use it and I'm going to say in the completion actually do compare do compare.
Now we haven't really done this far.
We don't know what they comprise and it's going to be.
But that's a function we still have to write.
Oh let's see how we're going to do that.
And we'll actually go ahead and then you find I'm going to call this on View Controller.
Plus compare
this one again has everything is before you.
I can't.
It is an extension to view controller and it has only one function it's called compare and they compare
function should give us like the two of them are similar or not.
Now before we can write or compare function we have to fix a few things one of them is I have to go
to my touches and it and I have to add that new function that we made that's called reveal and compare.
So I'm going to come in here and say in the compare now mode if that's the time I'm Vicot the second
time do this reveal it and compare it.
And we are revealing the second time because again the top died and we are comparing the two of them
against each other.
Here is something very important we never end up in the comparing now currently because comparing now
is false at the beginning and every time we come here it stays like that.
So something else I have to do is I have to say once you make this decision reset the computer now.
So comparing now becomes the opposite of what the campaign is.
So if this is the first time comparing now is false it becomes true.
If this was the second time compare now was true make it false.
Now why now we have a situation where we end up you know revealed and compare which is here.
We reveal the second time and now we have to compare in the completion.
And this is the part that says to compare which is the new function self dot compare not to compare
Now compare function compare function.
So now we have the cells that compare happening and I'm going to go back to compare in here.
I'm going to say well why now.
We have the first time we have this I can type it and you have to tell us if they are the same which
is very easy if the first time that internal number is second time that internal number then obviously
they are the same else they are different.
So for now and just for this listen I'm going to only print that I'm going to say print in print I'm
going to say same and yet I'm going to say different.
Let's see if that's going to work for me if I run this application now.
And it happened two times.
They should reveal they should show me the numbers and if they are the same numbers it should tell me
same.
And if they are not it should tell me are different essentially.
So here I got the first one.
One.
Now they compare.
Now is true.
The next one for and they are different.
If I it out again five and I bought another one zero different I've got four.
Now when I really tap on for even though we haven't flipped it back for I it says they are the same.
Let me find another one.
Three on one.
Are obviously different but the one and one are the same.
So in this lesson in our view controller we are of the few in your valuables.
First time second time and compare Now status then driven to the touches and touches and we decided
that depending on the compare.
Now start this video.
The second time should be the one we just tapped on or the first line should be the one we just hopped
on.
Depending on which one happened we either only flipped or flipped and compared and of course at the
end of each of them will reset the value of compair now.
Now in our Reveal and compare what we did is revealing the toilet which was what he had done before.
And in its completion block we said also compared the two times against each other.
And then they compare the simply found the internal number of 1 and 2 and they compared them against
each other.
Now that's all we have to do for this lesson.
I want to mention something to you and that's just if somebody was interested to do things a little
bit more differently you could actually use the same one flip to reveal for most of these revealed actions
you could actually completely trivial in the completion block of it.
Right.
If we are in the compair now also do the comparison.
That's something you could do.
I don't want to make it overly complicated that's why I wrote two different functions which are very
very similar.
So essentially you could use this very function if in here you had enough self that compare.
Now then do compare.
Otherwise don't do anything and use the very same function for most of the events that happens in the
Thatchers and that but I'll leave that to you to decide how you want to proceed with it.
So with that in mind we have an app that now can show us two different tiles and can compare them against
each other.
It doesn't really set them back.
So let's move on to the next person to fix that one.