Let's go ahead and add another text here.
And once a country dot I want population sex.
Now we're gonna have a problem here for a few reasons.
So first of all this country their population notice that is an integer so this is a tax so we need
to make sure that we pass inside of a strain just translate whatever the it is into a string.
Right.
So this is what we call casting right.
So now this is a string which is what I expected instead of a text.
So let's go ahead and save this and see what's going to happen and give it a run and you should see
of course side by side the name and population.
Now the better way to do this of course is to make things a little bit better because I want to make
sure that it is actually below naturally side.
Well by now you should know.
Let's put all of these inside of V stack right vertical stack.
Let me get all of these inside there.
Very nice.
Now we have that save and run.
Very good.
It's looking OK.
Anything I can do here in our v stack and pass a few parameters here.
For instance I can say alignment to be leading SOS from left to right.
And the spacing between them going to say eight and of course the content I'm just going to get rid
of that we don't need to pass anything there.
Let's save and run.
See what changes that might bring to us.
And while this is much better right.
So we have to top there the country and then the population.
Of course if you want to we can also come down here and add something like population or pop like this
and pass inside of a concatenate or they're like that save and run very good population.
And I can invoke a few modifiers here.
Let's say I want this to be a italic and I want to be have a font of sub heading.
OK very good.
If I want I can just go ahead and actually say for ground color I want this to be pink.
There we go.
Right.
Looking real good it kind of looks like a red but it is indeed pink.
Very good.
There we go.
So that's looking really good.
Now the other thing we can do we can actually refactor all of this into a different cell.
So right above our country and create another struct I'm going to call this cell row goes to the view
and var body it's a some sort of a view which means we have to return something.
Well in this case I just going to return all of this cut all of that and put inside there OK.
And because we expecting to get a country but we don't have a country there because now we have this
new Struct and this country won't work.
Well we can actually pass it as a property you're some say country it's to be of type country as such.
OK.
So at this point here we notice that we have no problem like this which means right here I'm going to
just call our cell row and for a country and when I pass the country that we have there.
So if you run there's no changes you will see of course everything should work exactly the same.
But at least we know we have refactor our code a little bit at least so for our country here let's perhaps
make it a little bit more interesting let's say font let's give it a title perhaps I read better and
foreground color I'm gonna say grey.
That's right.
This
looks a little bit better.
You probably can also see better in the subheading.
I'm just going to say a line and perhaps maybe a little bit bigger can always play around with these
that's to be it.
OK.
Well OK.
Much better.
I think this is better for you to see as I code here because you can actually see a little bit bigger.
Very good.
Obviously can change to your heart's content.
Next thing we need to do here is to make sure that when we click on each of these items here each of
this row we are taking somewhere else.
So we need to add some sort of navigation to that.
It's really easy to do so in Swifty y.
All we have to do is go back to our list in our body here and we have to include all of that inside
our navigation view.
So say navigation view as such.
And I'm going to just put all that inside of that.
So let's go ahead and perhaps Scoot Ed and I want to structure all of this.
There we go.
So now it's looking real good.
Now we have a navigation view to save and run this you'll see nothing really has changed.
But notice that at the top now we have some sort of space because this is where we can actually put
a title of our navigation view.
So with navigation view we are going to pass another element called navigation link navigation link
as such.
So what this will do.
I'm gonna have to enclose that inside of the actual cell row.
This makes sense because we want to have each cell row to be able to actually navigate somewhere else
when it's clicked OK.
So our navigation link has to have something inside of it meaning we have to pass in a destination.
Right.
This nation essentially says Where is it that you want to take me when this is clicked for knowledge
just pass a text that it will have the country dot name like this and the rest is just going to be empty
for now.
So save this and run while you can see that now that we added that navigation link and we enclosed our
cell row can see now we have these arrows which signify that indeed they can be click.
In fact if you click wow we have Mozambique was we passing the name of the country.
And notice also we are given for free I might add this back button there.
All of that is because we added navigation view which we also then included navigation link which also
means in our navigation link here I can add the title of our view.
So I can come down here and say dot navigation title bar like this and I can pass the title bar that
would say something like countries of the world.
It's even run and I can see says country of the world.
Very good.
And now because we have added an actual navigation bar title it tells us exactly here that.
OK this instead of just back which still is a back button but now is contextual because we've added
this navigation bar title that says countries of the world and look back it takes us back here.
OK.
So click this one the more left it's showing there.
Very good obviously for our destination here because it expects a view we can be a little bit more clever
about that can we.
So I can come down here and create a more sophisticated strike to here called Destiny and it's going
to be a view of our body just like what we had before.
And then of course we have to return something in our body.
Well what we want to do really here first of all is we're going to pass the countries was led country
be country type and then give more space for our body here we just gonna go ahead and passing a text.
OK.
And I'm going to do some interpolation here.
So a country that name like that country's name pop Pew Lei Shen is do another interpolation again here
make this string a country that population like that.
OK.
So as I say country name and population name that's very simple.
And we're gonna call this destiny here instead of having this text we're going to get rid of all of
that and call destiny and of course it expects us to pass the country which is going to be the country
object every passing year.
Right.
Very good.
So Ron everything still good.
But check this out and Mozambique's population is two thousand.
We can call us five hundred of course those are not real numbers but you get the idea here.
OK.
So at this point here you can do all sort of customization to our destiny force you can find a better
name than that but you can see the things we can do now just like any other view we can go ahead and
add different modifiers we can even put a background around this.
I mean we can do all sorts of things.