Wednesday, October 11, 2023

Unit Testing a SwiftUI Query

Helge Heß:

I’ve been wondering whether I could unit test a SwiftData Query, i.e. the SwiftUI property wrapper coming w/ SwiftData (in beta6 it is actually a macro). Aka whether I could unit test a SwiftUI view. This requires setting up an execution environment for the view, but surprisingly that actually works 🙂

Here’s the gist.


Comments RSS · Twitter · Mastodon

Leave a Comment