GCD or NSOperation?
You have now seen two different ways of architecting your code to support task-oriented parallelism, NSOperation and Grand Central Dispatch.
With GCD, the code for a particular operation tends to be concentrated in one place. You have a block that does work and then puts blocks onto other queues to do other work – the whole “layers of an onion” thing. GCD is very fast. There is little baggage associated with it. There is no reliance on KVO. GCD calls tend to be more ad-hoc and disposable, “I’ll just put this here to run this on the main queue” kinds of things. Plus, it is easier to copy and paste and create similar blocks doing the same work.
NSOperation tends to have the code more spread around. The code implementing an ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access