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 the @MainActor attribute to ensure the code is run on the main thread?
Below is code example where I believe it's currently crashing despite the @MainActor attribute:
@MainActor
@objc func navigateToLoginScreen() {
let vc = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LoginVC")
let navigationController = UINavigationController.init(rootViewController: vc)
self.view.window?.rootViewController = navigationController;
}