Last active
August 29, 2015 14:05
-
-
Save k0nserv/30ed0869da1e2d060872 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func onMainThread(action: () -> ()) { | |
dispatch_async(dispatch_get_main_queue(), action) | |
} | |
onMainThread { | |
myView.hidden = true | |
} | |
func inBackground(action: () -> ()) { | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), action) | |
} | |
inBackground { | |
fetchDataFromInternet() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment