When trying to call a method on a class marked as running on the MainActor from within a background DispatchQueue, I correctly get a compiler error, which goes away when calling it from DispatchQueu.main.async { … }. Also fine and expected.
But what is the mechanism that allows the compiler to diagnose this?
I just skimmed the API diffs for DispatchQueue, and so didn’t spot anything related to the MainActor.
Would something similar be implemented for third party libraries like RxSwift?