Next we're going to go and create our networking manager.
So right click on our project here and when it's a new file it's 50 wide that's fine or swift file it's
fine.
There's going to be net working manager as such and you can see it's at this level here for the project.
Very good.
So I'm gonna get rid of all of this.
Only that so far on what manager here.
Let's go ahead and create a class.
And of course not be net working manager.
This is gonna be exactly same as we had before.
So the superclass for our network manager here we're gonna pass the observable object.
And for the code we are going to start putting everything together.
Now remember first thing we're gonna add here is a wrapper at published goods is variable.
We gonna pass right now here it's going to be DVR data list.
Okay.
It's gonna be equal to quake API list as such and we're going to pass the features which will be just
an empty right now.
This quake API list here if I click and jump to it's going to show us that it's down here inside of
our quake dot Swift.
Now I've added this one here myself.
So this struct here is just wrapping the whole payload.
If you look at our earthquake notice everything is actually inside of our features are right here right.
So we are wrapping this features property inside of these struct here so that whenever we hit the feature
notice it has the same name as this property here.
OK.
So when we hit the features then we expect an array of features which is exactly what we want.
What features again these features here which contain properties and geometry OK so this is what needs
to be added.
So go ahead and add this quick API list has to be the quotable in passing this property.
OK.
So back to our manager there.
That we have that we got gonna go and add our internet just like we did before.
I'm going to pass anything and next here there is the code that I'm not going to be boring you with.
So this is something that we've done before.
It's literally the same code as we had in previous network managers so I'm gonna copy and paste the
code yourself that way.
We move faster.
OK.
So we have our code here.
Notice the only thing that is different here is our your owl here which is pointing to our Jason API.
That's the only thing really.
And of course we're passing the quick API list for the decoding of our payload here and we are printing
out the features which is this published variable there.
OK.
Looks like we're missing something here.
Yes let's finalize with that last one there.
Save this.
And we should be good with our networking manager.
So now we can go back to our content view.
Let's go.
Content a view like this.
And then we're going to invoke the at observed object.
All right this wrapper here to say that this var net working manager you go to networking manager is
such that instantiating at this point here we can use this network a manager anywhere to get stuff.
So what it can do now just make sure that this works because if you look at our network manager here
we have this print data list so we should be able to see something in our console pertaining to our
payload here who should be able to see all of these features objects inside there.
Let's see if that's true.
Go ahead and give it a run considering everything is good.
We shouldn't have any issues and just like that you can see something happen in our log here.
Make this bigger.
We are getting all of these payload all the adjacent information there.
So this is indeed a good thing.
So it goes against properties and place Puerto Rico.
All of these great stuff.
Very good.
So we should be very happy to know that indeed this is working we were getting the information that
we want.
And let's go back to our content for you there.
OK.
So now that we have that we can actually put all of that information inside of a list and hopefully
start seeing something in our user interface.
Let's go and do that.
And when I create a list here let me close down our bottom console there.
So list and I say networking manager.
So this observed object say Dot.
I'm going to go to Data list and I want to go and get features.
So what's happening here is I go to Data list.
What is that.
I'm just open here just to make sure that we are in the right place here.
So we are saying here we go to network manager we go to Data list and we actually go to invoke the features
part because our quake API list.
Remember he has this feature is property which contains all the features in array and it contains all
objects.
In this case properties in geometry which are all of these struct so let's go back here.
So that means then we get our features.
Of course I'm going to pass our I.D. here and for I.D. I'm just gonna get the proper Ts for all righty
and data in I'm going to just go ahead and say text data Dot.
Let's see what can I get right away.
Let's go ahead and get properties and get place.
Let's do that.
Let's a prop Bert t's dot place.
I believe that would work very good if you save it a home run just like that.
We should hopefully see a list containing Oliver like that.
Look at this it never gets old folks.
It really never gets old.
I love this stuff.
This is so great so great.
Anyway you can see now we are seeing what we want to see which is the whole payload or in this case
the places where earthquake have happened.
So we've got here to features loop through and got places for instance you can see this is in Chile
and continue going going to the second one and so forth.
And that's what's being shown here.
So just like before now that we have access or data we can do all sorts of things right.
We can go ahead and create a cell per say can customize it and display all the data we want.
In fact that's all we're gonna be doing in the next video.
But before we even played your next video here's a little challenge for you.
Go ahead and create a struct.
Call it Cell row or whatever you want and customize it and try to get other information pertaining to
the earthquake.
So you have the place you can start adding the magnitude and whatever else you want.
OK.
So that's just a little exercise that I'm very confident that you can go ahead and do it do that and
I'll see you in the next video.