Post

Replies

Boosts

Views

Activity

Reply to Observation and MainActor
A solution: Mark the offending line (where you see the error) as @MainActor For instance, I used to have this: @Observable @MainActor class ExperimentRepository { init() {} } let globalRepository = ExperimentRepository() // Call to main actor-isolated initializer 'init()' in a synchronous nonisolated context Doing the below resolved the issue. @MainActor let globalRepository = ExperimentRepository()
May ’24