Car Detail
As I stated earlier, I break views down into smaller views. I did the same for Car Detail as well. I want to say that breaking up the views in this section was done more for cleaner code than for its reusability. This is how I broke up Car Detail:
We'll create three smaller views, Basic, Detail, and Photos, and then add them to Car Detail. Let's get started on the Basic view first.
Creating Basic car info view
Now that we have an idea of what we will do in this chapter, let's get started:
- Open the
CarInfoBasicView
file and update the previews with the followingpreviewLayout
:CarInfoBasicView() .previewLayout(.fixed(width: 400, height: 100))
We have changed our preview layout to be a fixed size. Adding a fixed size helps me focus on the size instead of being inside a giant phone.
- Now, add the following code inside of the
body
variable by replacingText("Car Info Basic View...