Skip to content

Instantly share code, notes, and snippets.

@marmelroy
Created July 19, 2016 05:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marmelroy/2335d6fe92a276b10882d47b238ecbc4 to your computer and use it in GitHub Desktop.
Save marmelroy/2335d6fe92a276b10882d47b238ecbc4 to your computer and use it in GitHub Desktop.
let delay = DispatchTime.now() + .seconds(60)
DispatchQueue.main.after(when: delay) {
// Do something
}
@tachoknight
Copy link

Swift 3 seems to have changed it to:

let timeDelay = DispatchTime.now() + .seconds(60)
DispatchQueue.main.asyncAfter(deadline: timeDelay) {
       // Do something
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment