Why doesn't `Task.sleep` block the main thread?
19:35 28 Jan 2026

I have a RealityKit app, and I have this code running in main thread:

class MyARView {
  func additionalLoadingPrep() async {
    try? await Task.sleep(for: .seconds(10))
  }
} 
  public override func viewDidLoad() {
    Task { @MainActor in 
      // setup scene in arView
      await arView.additionalLoadingPrep()
    }
  }

I realize that during this 10 seconds, my custom System update calls (as System in ECS) still runs every frame. And I can confirm that these calls are also in main thread.

I thought I already put main thread to sleep for 10 seconds, so why can the system still be called? Is it because parallel processing of multiple cores in my CPU (or interleaving execution of single core CPU)?

ios concurrency realitykit