If you just want the delay function in
Swift 4 & 5
func delay(interval: TimeInterval, closure: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + interval) {
closure()
}
}
You can use it like:
delay(interval: 1) {
print("Hi!")
}