Mix new @Observable with MVVM and Combine

We currently have our entire app written as SwiftUI Views with ViewModels (currently set as @StateObjects). SwiftUI has a new feature in iOS 17 called @Observable which simplifies the MVVM pattern and would greatly reduce the complexity of our codebase.

However, our current ViewModels implement Combine pipelines on the @Published properties which allows us to do all sorts of things from validation of inputs to ensuring lists are filtered correctly.

Without the @Published property wrapper in the new @Observable macro, we don't have access to those combine pipelines and so we were wondering how others have solved this?

One idea we are floating around is using CurrentValueSubjects as the variable types, but that does pollute the code a little as we have to utilise .send() and .value in the Views which seems like an anti-pattern.

Any thoughts or help would be greatly appreciated!

I'd just like to affirm that we are running into a similar issue. Since @Observable is not designed to work with combine (I think?), why not just keep them as ObservableObject with @Published properties?

This is such a significant paradigm shift. I wish Apple had addressed this more thoroughly at WWDC23, rather than giving us those 'rest of the freaking owl' kind of examples.

Mix new @Observable with MVVM and Combine
 
 
Q