Experimenting more with @MainActor and view controllers, the following compiles and prints main thread: false.
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.global().async { self.mainActorIsolated() }
}
@MainActor
func mainActorIsolated() { print("main thread: \(Thread.isMainThread)") }
}
It does not compile for a similar class that does not inherit from UIViewController (Call to main actor-isolated instance method 'mainActorIsolated()' in a synchronous nonisolated context). Is this a bug?