How do you test SwiftUI screens: Previews, model tests, snapshots and UI tests?
The gist
A SwiftUI view is a declarative description with no accessible object tree, so checking it directly is awkward. The working strategy is a pyramid: logic lives in an @Observable model and is covered by fast unit tests; appearance is checked by Previews (by eye) and snapshot tests (automatically); end-to-end flows get a small number of UI tests. The key to every level is dependencies behind protocols, so you can substitute fakes.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep