Series: Deep Dive with NSOperation

Deep Dive with NSOperation

NSOperation is a high-level building block for performing and managing asynchronous work. With the NSOperation API you can stitch together complex series of tasks to do the work your application needs. By creating independent, reusable classes that perform a single task, operations make it easier to build, test, and reason about complex workflows.

Length: about 1 hour

Installments

1. NSOperation Basics

Subscribers only

In this episode we take a look at the basics of NSOperation, NSOperationQueue, starting from block operations and moving to custom NSOperation subclasses. We'll also see why it's important to make your operations thread safe.

2. Asynchronous Operations

Subscribers only

In this episode we examine the asynchronous (a.k.a concurrent) type of NSOperation where we are doing things that involve callback blocks or delegates.

3. NSOperation Dependencies

Subscribers only

In this episode we discuss dependent NSOperations. Using dependencies you can queue up a bunch of jobs and they will be run in the correct order, having one provide the necessary state for the next one to run. In the example, we take the large Hubble image, scale it down to a more appropriate size, then apply a Core Image filter to it. Each operation is dependent on the one before it, yet they are all queued up at the same time.

4. Advanced NSOperations

Subscribers only

In this episode, Ben continues exploring NSOperation-based architecture, this time writing operations that present UI for a login screen, load the Core Data stack, and operations that are composed of multiple lower-level operations.