Answers for "delay in swift"

2

settimeout in swift

DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { // Change `2.0` to the desired number of seconds.
   // Code you want to be delayed
}
Posted by: Guest on November-28-2019
0

delay code execution swift 5

let timer = 1

DispatchQueue.main.asyncAfter(deadline: .now() + timer) {
    // code to execute after 1 second
}
Posted by: Guest on April-22-2021
0

swift + time delay call main thread

DispatchQueue.main.asyncAfter(deadline: .now() + 1) { 
   //Your code
}
Posted by: Guest on May-09-2020
1

swift thread.sleep

while (true){
    print("sleep for 2 seconds.")
    sleep(2) // working
}
Posted by: Guest on October-21-2020
1

swift wait 5 seconds

sleep(5). // Argument is number of seconds
Posted by: Guest on October-12-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language