nzrsky / ODDispatch

Header-only GCD/DispatchQueue syntax sugar for ObjC 🚦

Home Page:https://github.com/Rogaven/ODDispatch.git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ODDispatch

Build Status codecov.io CocoaPods Compatible Carthage compatible Platform Twitter

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, alexx.nazaroff@gmail.com

License

ODDispatch is available under the MIT license. See the LICENSE file for more info.

About

Header-only GCD/DispatchQueue syntax sugar for ObjC 🚦

https://github.com/Rogaven/ODDispatch.git

License:MIT License


Languages

Language:Objective-C 81.9%Language:Ruby 18.0%Language:MATLAB 0.0%