Post

Replies

Boosts

Views

Activity

Reply to Observation and MainActor
I have continued to apply @MainActor to my VMs. In the old world, having a @StateObject used to infer a @MainActor for the whole View, see here. The @State doesn't make the same inference, which is the topic of that SE thread. Since the new @Observable macro doesn't make any assumptions about the actor that the property is observed on, I think we should continue to explicitly mark VMs as @MainActor, and manually mark the view as @MainActor, since this was already happening under the hood.
Dec ’23