@MainActor function not being called on Main thread?

I can't figure out why this line of code complains that it's sometimes not being called from the main thread. Shouldn't the fact that this function has the @MainActor attribute on it result in the function being added to the main queue therefore processed on the main thread?

Am I'm just naive to how the @MainActor attribute actually works?

Replies

Are you calling this function from the main thread?

Shouldn't the fact that this function has the @MainActor attribute on it result in the function being added to the main queue therefore processed on the main thread?

I would’ve thought so, yes.

Can you boil this down to a simple test project? If so, you should file a bug and attach that. Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"