Can I use EnvironmentStateObject with the @Observable macro? #55
Replies: 2 comments 1 reply
-
Hello, @GregoryZeng,
I don't have any ready-made option for instantiating In your own explorations, make sure you carefully read the Store observable objects chapter of the |
Beta Was this translation helpful? Give feedback.
-
Thanks for your prompt answer.
You mean OK, I thought that |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am a beginner in SwiftUI and GRDB so correct me if I am wrong 😂
The view models from the docs and examples use the Combine-style
ObservableObject
.https://swiftpackageindex.com/groue/grdbquery/0.9.0/documentation/grdbquery/mvvm
https://github.com/groue/GRDBQuery/tree/main/Documentation/MVVMDemo
I wonder if the
@Observable
macro can also apply to the view model with GRDB, removing the@Published
and theObservableObject
?https://developer.apple.com/documentation/swiftui/migrating-from-the-observable-object-protocol-to-the-observable-macro
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions