Post

Replies

Boosts

Views

Activity

Reply to Is there a way to update Observable on the main thread but not to read from it?
Thanks Quinn for chiming in. You are right, app architecture is not Apple's responsibility. I guess we just need to know the intended usage of the the API. So to that end, I guess the 'ask' is the following clarifications: Are we suppose to update properties of a @Observable on the main thread? Are we suppose to properties of an object that is a property of Observable on the main thread? Is it safe to read properties of a @Observable on a background thread? Is it safe to read properties of an object that is a property of @Observable on a background thread? Is there a way to enforce check at compile time for setting properties of @Observable (for example by decorating it with @MainActor), but at the same time allow read to be not on the main thread?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’24