swift show error message 1 second delay code example
Example 1: 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
}
Example 2: swift + time delay call main thread
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
//Your code
}