Created
May 19, 2024 02:03
-
-
Save tokizuoh/45001203e36fa691d3848a1d52996a2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
Task.detached { | |
await self.heavyCall() | |
} | |
} | |
func heavyCall() { | |
var count = 0 | |
while count < 1_000_000_000 { | |
count += 1 | |
} | |
print(Thread.isMainThread) // true or false? | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment