Last active
August 29, 2015 14:13
-
-
Save ajjames/b21e8a9feb16bd011477 to your computer and use it in GitHub Desktop.
Dispatch Utility for succinct ways of calling GCD
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
| // | |
| // DispatchUtility.swift | |
| // | |
| // Copyright (c) 2015 Andrew James. All rights reserved. | |
| // | |
| import Foundation | |
| func GCDDispatchMain(closure:()->()) | |
| { | |
| dispatch_async(dispatch_get_main_queue(), closure) | |
| } | |
| func GCDDispatchAsyncHigh(closure: ()->()) | |
| { | |
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), closure) | |
| } | |
| func GCDDispatchAsyncDefault(closure: ()->()) | |
| { | |
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), closure) | |
| } | |
| func GCDDispatchAsyncLow(closure: ()->()) | |
| { | |
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), closure) | |
| } | |
| func GCDDispatchAsyncBackground(closure: ()->()) | |
| { | |
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), closure) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment