Using Swift previews
We covered this in the last chapter, but before we write any SwiftUI code, we will look at a SwiftUI file. Open BarChartView
and you'll see our struct view, which we looked at in the previous chapter. If you scroll to the bottom, you will see static var previews. Previews are used to preview our design without having to launch the simulator. You should see a blank space to the right of your code, and at the top of this, you will see a button named Resume:
Click Resume, and you will see the preview appear:
Let's move on to building some charts.