So I come back again.
This lesson is going to be a very simple one.
I'm going to show you how to use a progress you.
The only thing I'm not going to show you in here is how to actually connect a progress view to something
that is happening on a network because that's most often what you use.
Progress view for the use it for reading values from a network or making sure something is happening
successfully on our application.
Something that looks cold and let us start a new project called Progress view.
And for now if only going to use it for everything and then I'm going over to my storyboard say give
me a progress view in here and there's a lot of you know set things that you can have for progress views
such as the track color or the progress color a style whether you want to be a board that doesn't have
the empty Tricor over there you want it to be the default that has the empty track with a little of
a light gray color.
And I'm going to set the progress to be zero at the very beginning.
So there is no progress.
I'm going to go to my assistant Even though say this that is the wrong outlet.
It's actually interesting that this happened because a lot of times for writing and dropping out that's
you you end up with this error.
I'm kind driving my actually view.
And if this happens you're connecting the wrong object.
So I let go of this one I'm going to go here to the actual outlet of the view or the scene.
And when I say control drag this one is my progress view and it says The type is you I progress.
So I know I'm connecting the right thing and that's about that.
So I have it there now I'm going to go to my programming and say that's really all those things.
Nice and tidy say I have a timer scheduled timer with targets and let me reformat everything.
And so it does repeat from the bottom.
No was there in full.
It has a selector let's say called some progress.
That's the function we have to write to get itself and the time intervals are every hundredths of a
second Sananda write the function call function some progress.
And here we have to do something.
And if you remember because I'm using it with a selector I have to have on at objective c exposure.
Otherwise it would give me an.
Maybe maybe a drop that for a second so we can see the error that you see in here.
So now the error says yes you have to have an objective c exposure.
So I'm going at that now what do you want to happen in the progress.
Well I'm going to see my progress.
You do not progress which is a float plus Ikhwan 500 of face value.
So we go there every hundredth of a second and be at the hundredth of a of 1 to the progress value.
So let's go ahead and run this if I put up my simulator of
me you should see
this.
Let's see once again it happened really quickly I didn't notice what happened.
Yes.
Perfect.
Now I know that ought to be able to see the progress a little bit more visibly and then go ahead in
here and saying go there every second.
But I've only a hundred of us I can so I'm going to maintain that one.
So now it's going to take 100 cycles to finish.
Let's go ahead as you can see it's starting to build really really slowly.
You know every every second is I think only a hundred of us I can tweet so.
And that's about that's that's how you make your progress.
Obviously the amount of the progress comes from somebody else and it is a little bit of a challenge
here that I don't know if you noticed that but what happens when we reach the end of the progress.
So if I set this back to a hundred and I run the application as you can imagine a mother of one sack
and we will see the entire progress happening.
I was done.
So what is happening right now with our time at if is still going there into are some progress function
and is trying to push the progress to numbers beyond our one.
But she's definitely not a good teacher so we have to have a system for essentially saying well if you
reach this number stop it don't go any further to do that and then go ahead and say I have a variable
let's call it my timer which is a timer and my time is this time.
So I'm going to reformat everything once again.
Perfect.
And then in the functions some progress and then I say if my progress view of progress is still below
1 obviously do this thing you have to keep increasing the value else I'm going to save my time Darth
invalidate.
So if you reach the hundredth percent of it if you reached Avorn go ahead and invalidate timer's don't
repeat it any more.
Which is obviously a very important exercise making sure that you don't have unnecessary tasks running
around your application that you that you essentially kill anyone that is not needed anymore.
So if you run the application in terms of what we see nothing is going to change.
But we know that now we don't have an unnecessary timer once we once we reach them.
So that's about that.
That's how you make your progress for you.
And let's move on to our next lesson.