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?
Post
Replies
Boosts
Views
Activity
The app I work on has the Swift Language Version set to Swift 4.2 for the Compiler Language.
There has been some issues with users experiencing crashes due to UI changes not occurring on the main thread. I've been unable to reproduce the crash and using the Main Thread Checker has turned up nothing. So to fix this I assumed I could make the functions that are doing the navigating @MainActor functions, but that seems to have fixed nothing.
Xcode doesn't seem to have an issue with me including the @MainActor attribute on the functions, the build works and nothing seems amiss. But I'm wondering if because I'm compiling with Swift 4.2 (and I believe @MainActor was added in Swift 5.5), it's not actually using @MainActor attribute to ensure the code is run on the main thread?