Series: Bolts Framework with Objective-C

Facebook's Bolts framework makes mobile application development easier. In this Bolts framework tutorial, Jeff Roberts covers how Bolts makes the asynchronous seem synchronous. If you have always wanted Javascript promises in your iOS or Android apps, then this is a series you must check out. Bolts is a framework that is an implementation of Promises and is intended to make working with asynchronous code as simple as working with synchronous code. Bolts is a very simple framework. There are 3 main classes in the framework that you will use in order to accomplish most everything. These classes are:
  • BFTask - An Objective-C implementation of a promise
  • BFTaskExecutor - A simple class to allow you to control which thread/queue your code runs on observes results on
  • BFTaskCompletionSource - A simple class you will use in your async code to communicate completion results
You will learn by looking at code in a real application. The application uses Bolts to retrieve data from a remote REST service. The Bolts framework is also used to asynchronously retrieve data from a local SQLite database. This data is then displayed in the UI in UITableViews and UICollectionTableViews. Different threads/queues are at play and you can see how simple Bolts makes it to build applications that remain responsive by using asynchronous code to keep as much as possible off of the UI thread. Running code on the UI thread is discouraged unless you are interacting with UI components. When you do, your applications can feel unresponsive or appear to freeze. Learn how to use Bolts to keep non-UI code off of the main thread. This Bolts framework tutorial will teach you everything you need to know about Bolts so that you can immediately begin using it in your iOS applications. The Bolts Framework comes in Swift, Objective-C and Android versions.