-2

I am currently almost at the end of the beginner xcode game I'm following, and then suddenly I encounter this extremely frustrating problem.

The code is:

 let time = dispatch_time(dispatch_time_t(DISPATCH_TIME_NOW), Int64
 (NSEC_PER_SEC)

 dispatch_after(time, dispatch_get_main_queue(), {
 self.nextRound()

 })

The tutorial I'm following is using Xcode 7, and unfortunately, I updated to 8 a couple of days ago.

Xcode is giving suggestions but it keeps saying add a coma to fix it, that doesn't work however.

Is there a way the code I have provided can be re-written in Swift 3/Xcode 8 compatible?

Thanks.

Prexto Rex
  • 19
  • 4

1 Answers1

1

If you want to run some code Async and with a delay:

DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
print("Runs Aysnc in 5 seconds later")
}
Hamish
  • 1,685
  • 22
  • 37