Skip to content

New error @MainActor "Call to main actor-isolated initializer 'init()' in a synchronous nonisolated context" #322

@DmitryKhristenko

Description

@DmitryKhristenko

Factory version: 2.5.3
Xcode version: 26.0 beta 3 (17A5276g)
Swift version: 6.2
Swift Concurrency checking: Complete
Default actor isolation: MainActor
Approachable concurrency: Yes

This post is related to post number 274, but the solution proposed in it does not help in my case. I found another solution, but I'm not sure if it's thread-safe.

Image ERROR: "Converting function value of type '@mainactor @sendable () -> Foo' to '@sendable () -> Foo' loses global actor 'MainActor'" Image

This code will be compiled in my case:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions