Check out example codes for "swift thread.sleep". It will help you in understanding the concepts better.

Code Example 1

while (true){
    print("sleep for 2 seconds.")
    sleep(2) // working
}

Learn ReactJs, React Native from akashmittal.com