How do you use Test-Driven Development for the view layer when there is no straightforward way to test SwiftUI views?
By extracting all the view configuration logic in a dedicated object and test that instead.
Xcode Previews and manual testing are not the only ways to make sure your views behave correctly. In this chapter, we’ll learn how to use tests to guide us in implementing the view behavior. The key is to make the view humble and free from any logic and have it ask what to show to an object that is not tied to SwiftUI, one we can easily implement test-first. We’ll call this ...