[Swift] Stop processing for comma n seconds (delayed processing)

What do you mean

//Stop for 1 second
sleep(1)

The above code can stop the process for 1 second, but writing sleep (0.5), for example, will result in an error. The argument of the sleep function must be specified with ** Uint32 , which means " 32-bit unsigned integer **" ... Anyway, floating point cannot be specified.

Thread.sleep

You can go with this.

// 0.Stop for 5 seconds
Thread.sleep(forTimeInterval: 0.5)

Recommended Posts

[Swift] Stop processing for comma n seconds (delayed processing)
for stop? Don't stop!