0

I am running the following in Playground, but nothing is getting printed :

DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + DispatchTimeInterval.seconds(1)) {
    print("hiii")
}
Nitish
  • 13,845
  • 28
  • 135
  • 263

1 Answers1

4

You can do this, to make it wait for your async thread:

PlaygroundPage.current.needsIndefiniteExecution = true
Bence Pattogato
  • 3,752
  • 22
  • 30