Check out example codes for "settimeout in swift". It will help you in understanding the concepts better.
Code Example 1
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { // Change `2.0` to the desired number of seconds.
// Code you want to be delayed
}
Code Example 2
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { // Change `2.0` to the desired number of seconds.
// Code you want to be delayed
}
Learn ReactJs, React Native from akashmittal.com