Jay Wilson developer. creator. coffee drinker.

Nice post about testing in SwiftUI

Nice post about testing in SwiftUI

Jon Reid, @qcoding, made a good article detailing what to test and what not to test in SwiftUI.

I like the emphasis on testing behavior not appearance. I think this is really important due to how SwiftUI handles refreshes. SwiftUI is going to update a view based on changes made so we need to make sure the behavior is producing the proper changes. We don't need to actaully test that the button is Blue instead of Red. We need to test did the conditional change and did it change to the value that's expected. We can visually see in SwiftUI previews that button will change colors based on the values given.

If you liked this post, consider buying me a coffee.

Or donate to Lambda Legal to help fight for trans and LGBTQIA+ rights.

Subscribe to my posts via your favorite feed reader.