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.
- Open Source: Macros And Additions For Making Objective-C Coding More Concise
- Open Source: Communication Libraries For Easy In iOS App HTTP Servers And Asynchronous UDP/TCP Communication
- Open Source: Library For Easy USB And TCP Communication Within iOS/Mac Apps
- Best Resources In iOS Development – December 12th, 2011
- Library For Easily Working With Ruby On Rails Apps With Objective-C Code Generation
Original article: Open Source Objective-C Asynchronous Coding Helper Library Inspired By C#’s Async And Await
©2013 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.





