Skip to content

Instantly share code, notes, and snippets.

@avdyushin
Created September 2, 2013 07:21
Show Gist options
  • Save avdyushin/6410033 to your computer and use it in GitHub Desktop.
Save avdyushin/6410033 to your computer and use it in GitHub Desktop.
Delayed function call using Grand Central Dispatch
double d = 2.0f; // Delay
dispatch_time_t t = dispatch_time(DISPATCH_TIME_NOW, d * NSEC_PER_SEC);
dispatch_after(t, dispatch_get_main_queue(), ^(void){
// Call any function
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment