2
Task { @MainActor // ERROR: Unknown attribute 'MainActor'
    handleSuccess(of: response)
}

I thought you can use actors on Tasks. Not sure what I'm doing wrong.

1
  • 1
    Closing this question is much like saying we should close all questions where developers forget to set translatesAutoresizingMaskIntoConstraints to false. The error is misleading. There's no question on internet with a solution for the error. Commented Jun 18 at 14:36

1 Answer 1

2

The error is misleading. Took me a few minutes to figure it out 🙃

You just need to add in after the actor. Like this:

Task { @MainActor in
    handleSuccess(of: response)
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.