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,487
  • 26
  • 128
  • 252

1 Answers1

3

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

PlaygroundPage.current.needsIndefiniteExecution = true
Bence Pattogato
  • 3,406
  • 20
  • 30