Get Updates By E-mail 

Article Written By:
Johann Dowa

Open Source Objective-C Asynchronous Coding Helper Library Inspired By C#’s Async And Await

  •  
  •  
  •  
  •  
  •  

Asynchronous code can become very complicated and difficult to maintain.   C# includes a number of language features such as the async and await keywords to help with async programming that we don’t have in Objective-C.

Joachim Bengtsson (@nevyn) has created a library called SPAsync providing several classes inspired by C#’s async and await – SPTask , SPAgent, and SPAwait.

As the readme states:

SPTask – System.Threading.Tasks.Task in .Net is very nice. It’s a standard library class representing any asynchronous operation that yields a single value. This is deceivingly simple, and gives you much more power of abstraction than you would initially believe.
SPTask is a minimal copy of .Net Task in Objective-C, with functionality to chain multiple asynchronous operations. You can think of it as an extremely lightweight ReactiveCocoa.

SPAgent – An experimental multithreading primitive. The goal is to make every “manager” style class multithreaded with its own work queue, and then make communication between these agents trivial.

SPAwait – Experimental copy of C# 5’s “await” keyword, using the preprocessor.

You can find SPAsync on Github here.

You can read some great insights on asynchrony, and using SPAsync on Nevyn’s blog here.  Definitely a great read if you’re unfamiliar with C# and you’re wondering why you should be interested in this library.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments