ODDispatch
Usage
ODDispatchOnce
@import ODDispatch;
// Before
static id singletone;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^(){
singletone = [Singletone new];
});
// After
static id singletone;
ODDispatchOnce(^{
singletone = [Singletone new];
});
ODDispatchAfter
// Before
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
}
// After
ODDispatchAfterInMainThread(2, ^{
});
ODDispatchAsyncInMainThread
// Before
dispatch_async(dispatch_get_main_queue(), ^{
});
// After
ODDispatchAsyncInMainThread(^{
});
ODDispatchAsyncInBackgroundThread
// Before
dispatch_async(dispatch_get_global_queue(priority, 0), ^{
});
// After
ODDispatchAsyncInBackgroundThread(^{
});
Installation
ODDispatch is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ODDispatch'
Author
Alexey Nazarov, [email protected]
License
ODDispatch is available under the MIT license. See the LICENSE file for more info.