Using Operation queues
In OperationQueue
, we will see another way to perform concurrency in iOS. OperationQueue
is a higher-level abstraction of the queue model; on the other hand, GCD is a lower-level C API. OperationQueue
is built on top of GCD but in a more object-oriented fashion. In this section, we will perform the same demo but with OperationQueue
, and we will see how simple it is, as with GCD.
Getting ready
Before getting started with OperationQueue
, let's talk about how it is different from GCD:
It doesn't follow FIFO and doesn't conform to First-In-First-Out like GCD. There are two reasons why it doesn't stick to FIFO. The first one is that you can set an execution priority to the operations so that the operation with the highest priority will be executed first, regardless of its order in the queue. The second thing is that you can add dependency between operations. Dependency means that some operations will not be executed unless some other operation is executed first, as some operation...