nonisolated Execution Differences Before and After Xcode 26.2

I have an older project that was created before Xcode 26.2.

In Xcode versions prior to 26.2, there was no Swift Compiler – Concurrency build setting.

With those older versions, the following behavior occurs: a nonisolated function executes off the main thread.

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        run()
    }

    private func run() {
        Task {
            await runInMainThread()
        }
    }
    
    func runInMainThread() async {
        print(">>>> IN runInMainThread(), Thread.isMainThread \(Thread.isMainThread)")
        await runInBackgroundThread()
    }
    
    private nonisolated func runInBackgroundThread() async {
        print(">>>> IN runInBackgroundThread(), Thread.isMainThread \(Thread.isMainThread)")
    }
}

Output:

    >>>> IN runInMainThread(), Thread.isMainThread true
    >>>> IN runInBackgroundThread(), Thread.isMainThread false

However, starting with Xcode 26.2, Apple introduced the Swift Compiler – Concurrency settings.

When running the same code with the default configuration:

Approachable Concurrency = Yes
Default Actor Isolation = MainActor

This is the output

Output:

    >>>> IN runInMainThread(), Thread.isMainThread true
    >>>> IN runInBackgroundThread(), Thread.isMainThread true

the nonisolated function now executes on the main thread.

This raises the following questions:

  1. What is the correct Swift Compiler – Concurrency configuration if I want a nonisolated function to run off the main thread?

  2. Is nonisolated still an appropriate way to ensure code runs on a background thread?

nonisolated Execution Differences Before and After Xcode 26.2
 
 
Q