1 00:00:00,300 --> 00:00:03,300 Next we're going to go and create our networking manager. 2 00:00:03,450 --> 00:00:09,960 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 3 00:00:09,960 --> 00:00:10,530 fine. 4 00:00:10,620 --> 00:00:18,860 There's going to be net working manager as such and you can see it's at this level here for the project. 5 00:00:18,900 --> 00:00:20,150 Very good. 6 00:00:20,220 --> 00:00:22,140 So I'm gonna get rid of all of this. 7 00:00:22,200 --> 00:00:24,450 Only that so far on what manager here. 8 00:00:24,480 --> 00:00:26,610 Let's go ahead and create a class. 9 00:00:26,790 --> 00:00:31,350 And of course not be net working manager. 10 00:00:31,350 --> 00:00:33,390 This is gonna be exactly same as we had before. 11 00:00:33,420 --> 00:00:38,860 So the superclass for our network manager here we're gonna pass the observable object. 12 00:00:39,390 --> 00:00:42,130 And for the code we are going to start putting everything together. 13 00:00:42,130 --> 00:00:47,610 Now remember first thing we're gonna add here is a wrapper at published goods is variable. 14 00:00:47,610 --> 00:00:52,020 We gonna pass right now here it's going to be DVR data list. 15 00:00:52,110 --> 00:00:52,770 Okay. 16 00:00:52,910 --> 00:01:00,560 It's gonna be equal to quake API list as such and we're going to pass the features which will be just 17 00:01:00,590 --> 00:01:01,860 an empty right now. 18 00:01:02,070 --> 00:01:09,840 This quake API list here if I click and jump to it's going to show us that it's down here inside of 19 00:01:09,840 --> 00:01:11,100 our quake dot Swift. 20 00:01:11,100 --> 00:01:13,260 Now I've added this one here myself. 21 00:01:13,290 --> 00:01:16,680 So this struct here is just wrapping the whole payload. 22 00:01:16,710 --> 00:01:21,640 If you look at our earthquake notice everything is actually inside of our features are right here right. 23 00:01:21,660 --> 00:01:28,620 So we are wrapping this features property inside of these struct here so that whenever we hit the feature 24 00:01:28,680 --> 00:01:31,590 notice it has the same name as this property here. 25 00:01:31,930 --> 00:01:32,150 OK. 26 00:01:32,180 --> 00:01:38,430 So when we hit the features then we expect an array of features which is exactly what we want. 27 00:01:38,510 --> 00:01:46,180 What features again these features here which contain properties and geometry OK so this is what needs 28 00:01:46,180 --> 00:01:47,010 to be added. 29 00:01:47,020 --> 00:01:51,910 So go ahead and add this quick API list has to be the quotable in passing this property. 30 00:01:51,910 --> 00:01:52,090 OK. 31 00:01:52,090 --> 00:01:53,390 So back to our manager there. 32 00:01:53,450 --> 00:01:58,700 That we have that we got gonna go and add our internet just like we did before. 33 00:01:58,700 --> 00:02:02,860 I'm going to pass anything and next here there is the code that I'm not going to be boring you with. 34 00:02:02,860 --> 00:02:05,260 So this is something that we've done before. 35 00:02:05,290 --> 00:02:10,390 It's literally the same code as we had in previous network managers so I'm gonna copy and paste the 36 00:02:10,390 --> 00:02:11,490 code yourself that way. 37 00:02:11,640 --> 00:02:12,910 We move faster. 38 00:02:12,910 --> 00:02:13,090 OK. 39 00:02:13,110 --> 00:02:14,170 So we have our code here. 40 00:02:14,170 --> 00:02:20,280 Notice the only thing that is different here is our your owl here which is pointing to our Jason API. 41 00:02:20,290 --> 00:02:21,600 That's the only thing really. 42 00:02:21,630 --> 00:02:27,730 And of course we're passing the quick API list for the decoding of our payload here and we are printing 43 00:02:27,760 --> 00:02:32,910 out the features which is this published variable there. 44 00:02:32,940 --> 00:02:33,490 OK. 45 00:02:33,520 --> 00:02:36,360 Looks like we're missing something here. 46 00:02:36,370 --> 00:02:39,670 Yes let's finalize with that last one there. 47 00:02:39,670 --> 00:02:40,860 Save this. 48 00:02:41,320 --> 00:02:45,350 And we should be good with our networking manager. 49 00:02:45,380 --> 00:02:47,980 So now we can go back to our content view. 50 00:02:47,990 --> 00:02:48,460 Let's go. 51 00:02:48,460 --> 00:02:50,140 Content a view like this. 52 00:02:50,140 --> 00:02:54,480 And then we're going to invoke the at observed object. 53 00:02:54,490 --> 00:03:02,640 All right this wrapper here to say that this var net working manager you go to networking manager is 54 00:03:02,640 --> 00:03:08,760 such that instantiating at this point here we can use this network a manager anywhere to get stuff. 55 00:03:08,770 --> 00:03:14,800 So what it can do now just make sure that this works because if you look at our network manager here 56 00:03:15,250 --> 00:03:21,610 we have this print data list so we should be able to see something in our console pertaining to our 57 00:03:22,210 --> 00:03:26,820 payload here who should be able to see all of these features objects inside there. 58 00:03:26,890 --> 00:03:28,460 Let's see if that's true. 59 00:03:28,540 --> 00:03:31,030 Go ahead and give it a run considering everything is good. 60 00:03:31,030 --> 00:03:38,670 We shouldn't have any issues and just like that you can see something happen in our log here. 61 00:03:38,770 --> 00:03:40,240 Make this bigger. 62 00:03:40,240 --> 00:03:44,740 We are getting all of these payload all the adjacent information there. 63 00:03:44,740 --> 00:03:47,440 So this is indeed a good thing. 64 00:03:47,460 --> 00:03:50,690 So it goes against properties and place Puerto Rico. 65 00:03:50,800 --> 00:03:52,660 All of these great stuff. 66 00:03:52,660 --> 00:03:53,100 Very good. 67 00:03:53,100 --> 00:03:57,910 So we should be very happy to know that indeed this is working we were getting the information that 68 00:03:57,910 --> 00:03:58,440 we want. 69 00:03:58,540 --> 00:04:00,300 And let's go back to our content for you there. 70 00:04:00,310 --> 00:04:00,520 OK. 71 00:04:00,550 --> 00:04:05,500 So now that we have that we can actually put all of that information inside of a list and hopefully 72 00:04:05,500 --> 00:04:07,780 start seeing something in our user interface. 73 00:04:07,780 --> 00:04:08,640 Let's go and do that. 74 00:04:08,640 --> 00:04:13,690 And when I create a list here let me close down our bottom console there. 75 00:04:13,730 --> 00:04:17,100 So list and I say networking manager. 76 00:04:17,110 --> 00:04:20,390 So this observed object say Dot. 77 00:04:20,470 --> 00:04:23,610 I'm going to go to Data list and I want to go and get features. 78 00:04:23,610 --> 00:04:25,780 So what's happening here is I go to Data list. 79 00:04:25,780 --> 00:04:27,670 What is that. 80 00:04:27,680 --> 00:04:31,460 I'm just open here just to make sure that we are in the right place here. 81 00:04:31,510 --> 00:04:37,860 So we are saying here we go to network manager we go to Data list and we actually go to invoke the features 82 00:04:37,870 --> 00:04:39,810 part because our quake API list. 83 00:04:39,820 --> 00:04:45,550 Remember he has this feature is property which contains all the features in array and it contains all 84 00:04:45,550 --> 00:04:46,540 objects. 85 00:04:46,640 --> 00:04:52,070 In this case properties in geometry which are all of these struct so let's go back here. 86 00:04:52,070 --> 00:04:54,550 So that means then we get our features. 87 00:04:54,650 --> 00:05:02,570 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 88 00:05:03,440 --> 00:05:10,130 and data in I'm going to just go ahead and say text data Dot. 89 00:05:10,130 --> 00:05:12,700 Let's see what can I get right away. 90 00:05:13,370 --> 00:05:18,270 Let's go ahead and get properties and get place. 91 00:05:18,320 --> 00:05:19,710 Let's do that. 92 00:05:19,830 --> 00:05:23,300 Let's a prop Bert t's dot place. 93 00:05:23,320 --> 00:05:27,350 I believe that would work very good if you save it a home run just like that. 94 00:05:27,350 --> 00:05:31,310 We should hopefully see a list containing Oliver like that. 95 00:05:31,310 --> 00:05:34,780 Look at this it never gets old folks. 96 00:05:34,790 --> 00:05:36,440 It really never gets old. 97 00:05:36,440 --> 00:05:37,340 I love this stuff. 98 00:05:37,340 --> 00:05:39,380 This is so great so great. 99 00:05:39,380 --> 00:05:45,290 Anyway you can see now we are seeing what we want to see which is the whole payload or in this case 100 00:05:45,290 --> 00:05:48,020 the places where earthquake have happened. 101 00:05:48,020 --> 00:05:53,870 So we've got here to features loop through and got places for instance you can see this is in Chile 102 00:05:54,560 --> 00:05:58,310 and continue going going to the second one and so forth. 103 00:05:58,310 --> 00:06:00,560 And that's what's being shown here. 104 00:06:00,560 --> 00:06:05,330 So just like before now that we have access or data we can do all sorts of things right. 105 00:06:05,330 --> 00:06:11,510 We can go ahead and create a cell per say can customize it and display all the data we want. 106 00:06:11,510 --> 00:06:13,340 In fact that's all we're gonna be doing in the next video. 107 00:06:13,340 --> 00:06:16,730 But before we even played your next video here's a little challenge for you. 108 00:06:16,730 --> 00:06:18,610 Go ahead and create a struct. 109 00:06:18,650 --> 00:06:25,760 Call it Cell row or whatever you want and customize it and try to get other information pertaining to 110 00:06:25,910 --> 00:06:27,290 the earthquake. 111 00:06:27,290 --> 00:06:31,330 So you have the place you can start adding the magnitude and whatever else you want. 112 00:06:31,360 --> 00:06:31,540 OK. 113 00:06:31,570 --> 00:06:36,830 So that's just a little exercise that I'm very confident that you can go ahead and do it do that and 114 00:06:36,830 --> 00:06:37,820 I'll see you in the next video.