Skip to content

Instantly share code, notes, and snippets.

@efremidze
Created May 17, 2017 00:45
Show Gist options
  • Save efremidze/0479e59284f2135a48f45943dc607bf2 to your computer and use it in GitHub Desktop.
Save efremidze/0479e59284f2135a48f45943dc607bf2 to your computer and use it in GitHub Desktop.
func delay(_ seconds: Int, _ queue: DispatchQueue = .main, _ closure: @escaping () -> Void) {
let time = DispatchTime.now() + .seconds(seconds)
queue.asyncAfter(deadline: time, execute: closure)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment