Avatar
これを実行すると @MainActor func foo() { print("#0", Thread.current, Thread.current == Thread.main) DispatchQueue.global().async { print("#1", Thread.current, Thread.current == Thread.main) Task { print("#2", Thread.current, Thread.current == Thread.main) } } } final class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) foo() } } #0 <_NSMainThread: 0x60000250c000>{number = 1, name = main} true #1 <NSThread: 0x60000251c480>{number = 8, name = (null)} false #2 <NSThread: 0x60000251c480>{number = 8, name = (null)} false となるので、既にそうなっています?(あれ?) (edited)