All Projects → mjmsmith → Gcdobjc

mjmsmith / Gcdobjc

Licence: mit
Objective-C wrapper for Grand Central Dispatch

Projects that are alternatives of or similar to Gcdobjc

Serrata
Slide image viewer library similar to Twitter and LINE.
Stars: ✭ 322 (-10.06%)
Mutual labels:  cocoapods
Sclalertview
Beautiful animated Alert View. Written in Objective-C
Stars: ✭ 3,426 (+856.98%)
Mutual labels:  cocoapods
Mfcard
Easily integrate Credit Card payments module in iOS App. Swift 4.0
Stars: ✭ 356 (-0.56%)
Mutual labels:  cocoapods
Habitica Ios
Native iOS app for Habitica
Stars: ✭ 324 (-9.5%)
Mutual labels:  cocoapods
Swift5 Module Template
An opinionated starting point for awesome, reusable Swift 5 modules
Stars: ✭ 331 (-7.54%)
Mutual labels:  cocoapods
Ehhorizontalselectionview
Horizontal table view style controller
Stars: ✭ 346 (-3.35%)
Mutual labels:  cocoapods
Easyrealm
EasyRealm is a micro-framework that helps you use Realm.
Stars: ✭ 320 (-10.61%)
Mutual labels:  cocoapods
Dknightversion
Manage Colors, Integrate Night/Multiple Themes. (Unmaintained)
Stars: ✭ 3,559 (+894.13%)
Mutual labels:  cocoapods
Persei
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift
Stars: ✭ 3,395 (+848.32%)
Mutual labels:  cocoapods
Swiftymenu
Simple and Elegant Drop down menu for iOS 🔥💥
Stars: ✭ 356 (-0.56%)
Mutual labels:  cocoapods
Snapkit
A Swift Autolayout DSL for iOS & OS X
Stars: ✭ 18,091 (+4953.35%)
Mutual labels:  cocoapods
Tbuiautotest
Generating UI test label automatically for iOS.
Stars: ✭ 333 (-6.98%)
Mutual labels:  cocoapods
Observable
The easiest way to observe values in Swift.
Stars: ✭ 346 (-3.35%)
Mutual labels:  cocoapods
Maplebacon
🍁🥓 Lightweight and fast Swift library for image downloading, caching and transformations
Stars: ✭ 322 (-10.06%)
Mutual labels:  cocoapods
Gzipswift
Swift framework that enables gzip/gunzip Data using zlib
Stars: ✭ 356 (-0.56%)
Mutual labels:  cocoapods
Fwplayer
A video player SDK for iOS, it is based on AVPlayer. https://se.linkedin.com/in/foks-huiwang, https://fokswang.wixsite.com/home
Stars: ✭ 321 (-10.34%)
Mutual labels:  cocoapods
Pagecontroller
Infinite paging controller, scrolling through contents and title bar scrolls with a delay
Stars: ✭ 344 (-3.91%)
Mutual labels:  cocoapods
Mevhorizontalcontacts
An iOS UICollectionViewLayout subclass to show a list of contacts with configurable expandable items.
Stars: ✭ 358 (+0%)
Mutual labels:  cocoapods
Ssspinnerbutton
Forget about typical stereotypic loading, It's time to change. SSSpinnerButton is an elegant button with a diffrent spinner animations.
Stars: ✭ 357 (-0.28%)
Mutual labels:  cocoapods
Pushnotificationmanager
Convenient and comprehensive api for push notification,provide 6 stems and 20 branchs' function,offer examples written by Objective-C and Swift respectively
Stars: ✭ 354 (-1.12%)
Mutual labels:  cocoapods

GCDObjC

GCDObjC is an Objective-C wrapper for the most commonly used features of Grand Central Dispatch. It has four main aims:

  • Organize the flat C API into appropriate classes.
  • Use intention-revealing names to distinguish between synchronous and asynchronous functions.
  • Use more convenient arguments such as time intervals.
  • Add convenience methods.

A Swift port is at GCDSwift.

Usage

GCDObjC requires ARC and iOS 6.0. (Prior to 6.0, dispatch objects were not considered Objective-C objects, and therefore required manual memory management.)

GCDObjC.h is the only header file that needs to be imported.

For usage examples, see GCDObjCTests.m.

Install via CocoaPods:

pod "GCDObjC"

GCDQueue

Queues are implemented in the GCDQueue class.

  • convenience accessors for global queues
+ (GCDQueue *)mainQueue;
+ (GCDQueue *)globalQueue;
+ (GCDQueue *)highPriorityGlobalQueue;
+ (GCDQueue *)lowPriorityGlobalQueue;
+ (GCDQueue *)backgroundPriorityGlobalQueue;
  • testing the current execution context
+ (BOOL)isMainQueue;
  • creating serial and concurrent queues
- (instancetype)initSerial;
- (instancetype)initConcurrent;
  • queueing blocks for asynchronous execution
- (void)queueBlock:(dispatch_block_t)block;
- (void)queueBlock:(dispatch_block_t)block afterDelay:(double)seconds;
- (void)queueBlock:(dispatch_block_t)block inGroup:(GCDGroup *)group;
  • queueing blocks for synchronous execution
- (void)queueAndAwaitBlock:(dispatch_block_t)block;
- (void)queueAndAwaitBlock:(void (^)(size_t))block iterationCount:(size_t)count;
  • queueing barrier blocks for synchronous or asynchronous execution
- (void)queueBarrierBlock:(dispatch_block_t)block;
- (void)queueAndAwaitBarrierBlock:(dispatch_block_t)block;
  • queueing notify blocks on groups
- (void)queueNotifyBlock:(dispatch_block_t)block inGroup:(GCDGroup *)group;
  • suspending and resuming a queue
- (void)suspend;
- (void)resume;
  • associating context data with a key
- (void *)contextForKey:(const void *)key;
- (void)setContext:(void *)context forKey:(const void *)key;

GCDSemaphore

Semaphores are implemented in the GCDSemaphore class.

  • creating semaphores
- (instancetype)init;
- (instancetype)initWithValue:(long)value;
  • signaling and waiting on a semaphore
- (BOOL)signal;
- (void)wait;
- (BOOL)wait:(double)seconds;

GCDGroup

Groups are implemented in the GCDGroup class.

  • creating groups
- (instancetype)init;
  • entering and leaving a group
- (void)enter;
- (void)leave;
  • waiting on completion of a group
- (void)wait;
- (BOOL)wait:(double)seconds;

Macros

Two macros are provided for wrapping dispatch_once() calls.

  • executing a block only once: GCDExecOnce(block)
for (int i = 0; i < 10; ++i) {
    GCDExecOnce(^{ NSLog(@"This will only be logged once."); });
}
  • creating a singleton instance of a class: GCDSharedInstance(block)
+ (instancetype)sharedInstance {
  GCDSharedInstance(^{ return [self new]; });
}

The block supplied to GCDSharedInstance() must return an instance of the desired class.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].