time delay in swift 5 code example
Example 1: swift thread.sleep
while (true){
print("sleep for 2 seconds.")
sleep(2) // working
}
Example 2: swift wait 5 seconds
sleep(5). // Argument is number of seconds
while (true){
print("sleep for 2 seconds.")
sleep(2) // working
}
sleep(5). // Argument is number of seconds