NSDispatch 1.0.1

NSDispatch 1.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jun 2016

Maintained by Tanner Bennett.



NSDispatch is an Objective-C wrapper for libispatch. NSDispatch's class and method names are based off of the official Apple implementation of libdispatch for Swift 3, and use Objective-C and Cocoa API naming conventions.

NSDispatch is forked from GCDObjC, who's four main aims are to:

  • 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.

Usage

NSDispatch requires ARC. NSDispatch.h is the only header file that needs to be imported. For usage examples, see NSDispatchTests.m.

To install NSDispatch via CocoaPods:

  • Add pod 'NSDispatch' to your podfile.
  • In Terminal, cd /your-project-directory/ and type pod install.
  • Use the .workspace file that CocoaPods generates when working on your project from this point on.

Warning

This project uses the NS namespace for it's classes. Typically this namespace is typically reserved for Apple classes in Objective-C. However, the only point of this fun and quick little prtoject was to look, read, and behave as if it was an Apple created library for concurency. Changing the namespace to anything but NS would defeat the purpose of the project.

It is very unlikely that Apple will ever make any classes using the designator NSDispatch, however if you are concerned about future compatibility because of something Apple might change then you should do one of the following things:

  • Use the project NSDispatch was forked from, GDCObjC. They are already extremely similar. The main thing that was changed in this fork is the naming schemes.
  • Use one of the many other existing libdispatch Objective-C wrappers avaliable.
  • Feel free to fork NSDispatch and change the class namespaces to some other two-or-three-letter designator and continue using it to your heart's desire.

On the off chance than Apple ever does make an NSDispatch class/library, I will immediately deprecate this project.

This code is provided as-is. Include it in your own projects at your own risk.