Unit Test the Observation Framework
<p>When I heard about the new Observation framework in WWDC 2023, like all good fans of Combine (we still exist!), I was naturally horrified.</p>
<p>Combine is no longer an implementation detail of SwiftUI. Our hard-earned knowledge of testing <code>@Published</code> properties is deprecated.</p>
<p>Today, we’re going to discover how to unit test <code>@Observable</code> view models.</p>
<p>This is a sequel to my six-part epic, <a href="https://medium.com/better-programming/async-unit-testing-in-swift-eed4927480cd" rel="noopener">Async Unit Testing in Swift</a>. I’ll be updating <a href="https://github.com/jacobsapps/bev17/tree/main" rel="noopener ugc nofollow" target="_blank">Bev</a>, my trusty, boozy side project, to iOS 17 while maintaining full test coverage.</p>
<p><a href="https://betterprogramming.pub/unit-test-the-observation-framework-d0f0fe240944"><strong>Website</strong></a></p>