1 00:00:00,630 --> 00:00:03,320 Let's go ahead and add another text here. 2 00:00:03,320 --> 00:00:09,440 And once a country dot I want population sex. 3 00:00:09,770 --> 00:00:11,930 Now we're gonna have a problem here for a few reasons. 4 00:00:11,930 --> 00:00:17,520 So first of all this country their population notice that is an integer so this is a tax so we need 5 00:00:17,520 --> 00:00:24,720 to make sure that we pass inside of a strain just translate whatever the it is into a string. 6 00:00:24,720 --> 00:00:25,010 Right. 7 00:00:25,010 --> 00:00:27,020 So this is what we call casting right. 8 00:00:27,030 --> 00:00:30,420 So now this is a string which is what I expected instead of a text. 9 00:00:30,450 --> 00:00:35,820 So let's go ahead and save this and see what's going to happen and give it a run and you should see 10 00:00:35,820 --> 00:00:38,780 of course side by side the name and population. 11 00:00:38,790 --> 00:00:43,500 Now the better way to do this of course is to make things a little bit better because I want to make 12 00:00:43,500 --> 00:00:46,190 sure that it is actually below naturally side. 13 00:00:46,290 --> 00:00:47,650 Well by now you should know. 14 00:00:47,760 --> 00:00:52,950 Let's put all of these inside of V stack right vertical stack. 15 00:00:52,950 --> 00:00:56,140 Let me get all of these inside there. 16 00:00:56,280 --> 00:00:56,790 Very nice. 17 00:00:56,790 --> 00:01:01,000 Now we have that save and run. 18 00:01:01,050 --> 00:01:01,530 Very good. 19 00:01:01,530 --> 00:01:02,590 It's looking OK. 20 00:01:02,610 --> 00:01:06,300 Anything I can do here in our v stack and pass a few parameters here. 21 00:01:06,300 --> 00:01:12,450 For instance I can say alignment to be leading SOS from left to right. 22 00:01:12,630 --> 00:01:17,310 And the spacing between them going to say eight and of course the content I'm just going to get rid 23 00:01:17,310 --> 00:01:19,310 of that we don't need to pass anything there. 24 00:01:19,440 --> 00:01:20,400 Let's save and run. 25 00:01:20,400 --> 00:01:23,700 See what changes that might bring to us. 26 00:01:23,700 --> 00:01:25,570 And while this is much better right. 27 00:01:25,600 --> 00:01:28,870 So we have to top there the country and then the population. 28 00:01:28,950 --> 00:01:38,400 Of course if you want to we can also come down here and add something like population or pop like this 29 00:01:39,390 --> 00:01:48,840 and pass inside of a concatenate or they're like that save and run very good population. 30 00:01:48,840 --> 00:01:52,080 And I can invoke a few modifiers here. 31 00:01:52,080 --> 00:02:00,820 Let's say I want this to be a italic and I want to be have a font of sub heading. 32 00:02:01,230 --> 00:02:04,810 OK very good. 33 00:02:04,840 --> 00:02:13,330 If I want I can just go ahead and actually say for ground color I want this to be pink. 34 00:02:13,330 --> 00:02:13,870 There we go. 35 00:02:13,890 --> 00:02:14,180 Right. 36 00:02:14,200 --> 00:02:17,350 Looking real good it kind of looks like a red but it is indeed pink. 37 00:02:17,380 --> 00:02:17,830 Very good. 38 00:02:17,830 --> 00:02:18,280 There we go. 39 00:02:18,280 --> 00:02:19,360 So that's looking really good. 40 00:02:19,360 --> 00:02:24,060 Now the other thing we can do we can actually refactor all of this into a different cell. 41 00:02:24,370 --> 00:02:31,660 So right above our country and create another struct I'm going to call this cell row goes to the view 42 00:02:32,020 --> 00:02:39,150 and var body it's a some sort of a view which means we have to return something. 43 00:02:39,160 --> 00:02:45,710 Well in this case I just going to return all of this cut all of that and put inside there OK. 44 00:02:45,790 --> 00:02:51,130 And because we expecting to get a country but we don't have a country there because now we have this 45 00:02:51,130 --> 00:02:53,190 new Struct and this country won't work. 46 00:02:53,560 --> 00:03:00,760 Well we can actually pass it as a property you're some say country it's to be of type country as such. 47 00:03:01,580 --> 00:03:01,950 OK. 48 00:03:01,990 --> 00:03:09,550 So at this point here we notice that we have no problem like this which means right here I'm going to 49 00:03:09,550 --> 00:03:17,730 just call our cell row and for a country and when I pass the country that we have there. 50 00:03:17,800 --> 00:03:23,500 So if you run there's no changes you will see of course everything should work exactly the same. 51 00:03:23,500 --> 00:03:29,560 But at least we know we have refactor our code a little bit at least so for our country here let's perhaps 52 00:03:29,560 --> 00:03:37,570 make it a little bit more interesting let's say font let's give it a title perhaps I read better and 53 00:03:37,570 --> 00:03:41,670 foreground color I'm gonna say grey. 54 00:03:41,850 --> 00:03:43,160 That's right. 55 00:03:43,200 --> 00:03:43,620 This 56 00:03:46,450 --> 00:03:48,240 looks a little bit better. 57 00:03:48,310 --> 00:03:51,130 You probably can also see better in the subheading. 58 00:03:51,130 --> 00:03:58,710 I'm just going to say a line and perhaps maybe a little bit bigger can always play around with these 59 00:03:58,720 --> 00:03:59,200 that's to be it. 60 00:03:59,230 --> 00:03:59,780 OK. 61 00:03:59,780 --> 00:04:00,010 Well OK. 62 00:04:00,010 --> 00:04:00,640 Much better. 63 00:04:00,700 --> 00:04:06,450 I think this is better for you to see as I code here because you can actually see a little bit bigger. 64 00:04:06,460 --> 00:04:06,880 Very good. 65 00:04:06,970 --> 00:04:10,590 Obviously can change to your heart's content. 66 00:04:10,600 --> 00:04:15,670 Next thing we need to do here is to make sure that when we click on each of these items here each of 67 00:04:15,670 --> 00:04:17,770 this row we are taking somewhere else. 68 00:04:17,770 --> 00:04:20,460 So we need to add some sort of navigation to that. 69 00:04:20,590 --> 00:04:23,120 It's really easy to do so in Swifty y. 70 00:04:23,170 --> 00:04:28,690 All we have to do is go back to our list in our body here and we have to include all of that inside 71 00:04:28,690 --> 00:04:30,280 our navigation view. 72 00:04:30,310 --> 00:04:33,190 So say navigation view as such. 73 00:04:34,060 --> 00:04:37,300 And I'm going to just put all that inside of that. 74 00:04:37,300 --> 00:04:44,020 So let's go ahead and perhaps Scoot Ed and I want to structure all of this. 75 00:04:44,020 --> 00:04:44,470 There we go. 76 00:04:44,500 --> 00:04:46,330 So now it's looking real good. 77 00:04:46,330 --> 00:04:53,480 Now we have a navigation view to save and run this you'll see nothing really has changed. 78 00:04:53,490 --> 00:04:57,810 But notice that at the top now we have some sort of space because this is where we can actually put 79 00:04:57,840 --> 00:05:00,930 a title of our navigation view. 80 00:05:01,350 --> 00:05:08,730 So with navigation view we are going to pass another element called navigation link navigation link 81 00:05:08,830 --> 00:05:09,720 as such. 82 00:05:10,170 --> 00:05:11,850 So what this will do. 83 00:05:11,910 --> 00:05:15,600 I'm gonna have to enclose that inside of the actual cell row. 84 00:05:15,600 --> 00:05:21,480 This makes sense because we want to have each cell row to be able to actually navigate somewhere else 85 00:05:21,720 --> 00:05:24,710 when it's clicked OK. 86 00:05:24,870 --> 00:05:32,460 So our navigation link has to have something inside of it meaning we have to pass in a destination. 87 00:05:32,460 --> 00:05:32,790 Right. 88 00:05:32,790 --> 00:05:38,610 This nation essentially says Where is it that you want to take me when this is clicked for knowledge 89 00:05:38,620 --> 00:05:45,420 just pass a text that it will have the country dot name like this and the rest is just going to be empty 90 00:05:45,450 --> 00:05:46,080 for now. 91 00:05:46,250 --> 00:05:54,980 So save this and run while you can see that now that we added that navigation link and we enclosed our 92 00:05:54,980 --> 00:06:01,100 cell row can see now we have these arrows which signify that indeed they can be click. 93 00:06:01,100 --> 00:06:08,080 In fact if you click wow we have Mozambique was we passing the name of the country. 94 00:06:08,150 --> 00:06:12,890 And notice also we are given for free I might add this back button there. 95 00:06:12,950 --> 00:06:18,980 All of that is because we added navigation view which we also then included navigation link which also 96 00:06:18,980 --> 00:06:23,300 means in our navigation link here I can add the title of our view. 97 00:06:23,720 --> 00:06:31,150 So I can come down here and say dot navigation title bar like this and I can pass the title bar that 98 00:06:31,190 --> 00:06:36,090 would say something like countries of the world. 99 00:06:36,420 --> 00:06:41,950 It's even run and I can see says country of the world. 100 00:06:41,990 --> 00:06:42,890 Very good. 101 00:06:42,890 --> 00:06:48,390 And now because we have added an actual navigation bar title it tells us exactly here that. 102 00:06:48,410 --> 00:06:54,740 OK this instead of just back which still is a back button but now is contextual because we've added 103 00:06:54,740 --> 00:07:01,020 this navigation bar title that says countries of the world and look back it takes us back here. 104 00:07:01,430 --> 00:07:01,780 OK. 105 00:07:01,820 --> 00:07:05,200 So click this one the more left it's showing there. 106 00:07:05,300 --> 00:07:11,810 Very good obviously for our destination here because it expects a view we can be a little bit more clever 107 00:07:11,870 --> 00:07:13,250 about that can we. 108 00:07:13,250 --> 00:07:19,250 So I can come down here and create a more sophisticated strike to here called Destiny and it's going 109 00:07:19,250 --> 00:07:23,440 to be a view of our body just like what we had before. 110 00:07:23,480 --> 00:07:26,640 And then of course we have to return something in our body. 111 00:07:26,810 --> 00:07:32,150 Well what we want to do really here first of all is we're going to pass the countries was led country 112 00:07:32,600 --> 00:07:40,840 be country type and then give more space for our body here we just gonna go ahead and passing a text. 113 00:07:41,330 --> 00:07:42,030 OK. 114 00:07:42,080 --> 00:07:45,450 And I'm going to do some interpolation here. 115 00:07:45,490 --> 00:07:57,170 So a country that name like that country's name pop Pew Lei Shen is do another interpolation again here 116 00:07:58,460 --> 00:08:05,600 make this string a country that population like that. 117 00:08:06,030 --> 00:08:06,430 OK. 118 00:08:06,550 --> 00:08:10,190 So as I say country name and population name that's very simple. 119 00:08:10,190 --> 00:08:15,500 And we're gonna call this destiny here instead of having this text we're going to get rid of all of 120 00:08:15,500 --> 00:08:24,410 that and call destiny and of course it expects us to pass the country which is going to be the country 121 00:08:24,500 --> 00:08:25,960 object every passing year. 122 00:08:25,970 --> 00:08:27,140 Right. 123 00:08:27,140 --> 00:08:27,800 Very good. 124 00:08:27,800 --> 00:08:30,730 So Ron everything still good. 125 00:08:30,740 --> 00:08:35,390 But check this out and Mozambique's population is two thousand. 126 00:08:35,470 --> 00:08:41,660 We can call us five hundred of course those are not real numbers but you get the idea here. 127 00:08:41,660 --> 00:08:42,010 OK. 128 00:08:42,980 --> 00:08:48,500 So at this point here you can do all sort of customization to our destiny force you can find a better 129 00:08:48,500 --> 00:08:54,020 name than that but you can see the things we can do now just like any other view we can go ahead and 130 00:08:54,290 --> 00:08:58,110 add different modifiers we can even put a background around this. 131 00:08:58,220 --> 00:08:59,660 I mean we can do all sorts of things.