TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Unit-Test and SwiftUI Article

Forums > Articles

@hayd  

Are there any articles or books available on good practices for unit-testing SwiftUI, including in the architecture that extends the View adding an @ObservableObject ViewModel?

I purchased and thouroughly enjoyed the book on Testing but don't recall any SwiftUI related topics in there.

Much Appreciated!

2      

I had the same question a few months ago. I did not find any relevant articles, and only one relevant book:

The Kodeco (formerly Wenderlich) book "SwiftUI by Tutorials" has a chapter 4 on "Testing and Debugging" with 26 pages on UI testing. The book is expensive at $60. I own the previous edition of the book, but I have not taken the time to read much of it, so I can’t comment on its quality.

Even if you decide not to buy the book, you can freely download the source code from GitHub and study the code for chapter 4: https://github.com/kodecocodes/sui-materials

2      

Here are two videos to start with. This guy is just amazing in explaining some advanced topics in simple way. You can give it a try :)

Unit Testing - here @ObservableObject is covered.

https://youtu.be/eqdvIUKsM2A?si=4Vgv3xSQ62ysfoGp

UI Testing

https://youtu.be/RoDUYFuNeJU?si=PkrQUYlhBeye9hO1

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.