bright-dog-91720
08/06/2025, 1:49 PMParticipant as ObservableObject with computed properties probably works great for SwiftUI if you bind directly to the objects and properties as the source of truth. But if you want to build code-based, custom data flows it takes a chunk more work.
Any plans to migrate to a more reactive-friendly pattern / embracing @Published, CurrentValueSubject, AsyncSequence or @Observable?better-house-11852
08/07/2025, 5:50 PMable-flag-12349
08/08/2025, 6:38 AMRoom. Also, there's a lot of flexibility in using AsyncSequence / Stream or Combine vs SwiftUI-friendly primitives as you avoid storing some intermediate state.
Currently, there are no plans for a direct rewrite (at least in 2.x). However, you can still re-wrap these objects and shape your state differently. You can take a look at some recent examples that map @ObservableObject via the publisher to your own model + @Observable macro.able-flag-12349
08/08/2025, 6:42 AMRoom will still behave reactively:
// Notify Room when state mutates
Task { @MainActor in
self.objectWillChange.send()
}
you don't need a direct @Published thing in order to achieve that with the old Combine-based hack ⬆️able-flag-12349
08/08/2025, 6:43 AM.changes wrapper works in my previous example 🙂 Achieving that with @Observable macro is not that easy as the "publishing" process is way more granular and sophisticatedable-flag-12349
08/08/2025, 6:44 AMbright-dog-91720
08/08/2025, 8:00 AMObservableObject like this is that it's a willChange not a didChange and you don't have access to the actual change.
Am I reading the code correctly that it ends up emitting objectWillChange once the state has actually been mutated so it has didChange semantics? By virtue of the change doing a context swap with the Task?able-flag-12349
08/08/2025, 8:33 AMoldValue thing in this casebright-dog-91720
08/08/2025, 4:02 PMobjectWillChange-based publisher but didChange semantics are a winner for when we do want this. Thanks @able-flag-12349.