We just explored dispatch queues and how we can use them to schedule tasks that need to be performed on a different thread. You saw how this speeds up code and how it avoids blocking the main thread. In this section, we're going to take this all one step further. The first reason for this is because our asynchronous work would be better organized if we have an object that we can schedule for execution rather than a closure. Closures pollute our code and they are much harder to reuse.
The solution to this is using an
Operation instead of a closure. And instead of queueing everything in a dispatch queue, we should queue our
Operation instances on an
OperationQueue and the