Preview in SwiftUI speeds up the development process as we don’t need to build and run our application every time we make some changes. Here are some tips how I use the Preview function.

Light and dark mode side-by-side

Change your code this way:

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            ContentView()
                .preferredColorScheme(.light)
            ContentView()
                .preferredColorScheme(.dark)
        }
    }
}

Focus on important part not the whole screen

Add this:

    .previewLayout(.sizeThatFits)

I hope it helps and you will be more efficient.