Skip to content

Instantly share code, notes, and snippets.

@perlguy99
Created August 7, 2017 15:49
Show Gist options
  • Save perlguy99/93e7d971d323ca732185279edac2885d to your computer and use it in GitHub Desktop.
Save perlguy99/93e7d971d323ca732185279edac2885d to your computer and use it in GitHub Desktop.
Operate on main thread
// Usage:
// UI {
// Anything in here will execute on the main thread
// }
func UI(_ block: @escaping ()->Void) {
DispatchQueue.main.async(execute: block)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment