Skip to content

Instantly share code, notes, and snippets.

@tokizuoh
Created May 19, 2024 02:03
Show Gist options
  • Save tokizuoh/45001203e36fa691d3848a1d52996a2b to your computer and use it in GitHub Desktop.
Save tokizuoh/45001203e36fa691d3848a1d52996a2b to your computer and use it in GitHub Desktop.
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