Did you know that you can preview SwiftUI views on a physical device? This feature is built into Xcode. Connect a device to your development machine and open a SwiftUI view in Xcode. Xcode automatically brings up the canvas on the right, showing you a preview of the SwiftUI view you are working on.

How to Preview SwiftUI Views on a Physical Device

To preview the SwiftUI view on the device you connected to your development machine, you toggle the Preview On Device button at the bottom of the canvas.

How to Preview SwiftUI Views on a Physical Device

It may take a few moments for the preview to show up on the device. I find previewing SwiftUI views on a device useful to get a better sense of the look and feel of a user interface. Previewing a SwiftUI view on a device shortens the feedback loop and is much faster than building the application, installing it on a device, and navigating to the view. Another benefit is that you can use preview data, making it easier to test various configurations. That alone can save you quite a bit of time.

Previewing a SwiftUI view on a device is managed through Xcode Previews, an application that is installed on your device.

How to Preview SwiftUI Views on a Physical Device

Note that the preview on your device is a live preview so you can interact with the preview just like you can in the canvas.