Objective-C utility methods for performing Grand Central Dispatch (GCD) concurrency operations, like context switching.
Simply plop this repo into your project, and you should be good to go.
+ (void)performBlockOnMainQueue:(void(^)(void))block; // async
+ (void)performBlockOnMainQueueSynchronously:(void(^)(void))block; // sync
+ (void)performBlockOnMainQueue:(void(^)(void))block afterDelay:(NSTimeInterval)delay;
+ (void)performBlockInBackground:(void(^)(void))block;
+ (void)performBlockSynchronously:(void(^)(void))block;
+ (void)performBlockSynchronouslyOnMainQueue:(void(^)(void))block;
+ (void)performBlockOnMainQueue:(void(^)(void))block afterDelay:(NSTimeInterval)delay
{
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), block);
}