Cabeçalho:
//
// GCDMacros.h
//
#ifndef GCDMacros_h
#define GCDMacros_h
typedef void(^VoidBlock)();
void UIThread(VoidBlock block);
void BackgroundThread(VoidBlock block);
#endif
Implementação:
//
// GCDMacros.m
//
#import "GCDMacros.h"
void UIThread(VoidBlock block)
{
dispatch_async(dispatch_get_main_queue(), block);
}
void BackgroundThread(VoidBlock block)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
}