Daily iOS
Concurrency

GCD vs OperationQueue

You're building an image pipeline: download, resize, then save to the disk cache, and when the user scrolls you need to cancel work in progress. Would you pick GCD or OperationQueue?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

When you need dependencies, cancellation, a limit on concurrent work, and KVO state observation, OperationQueue fits better than GCD. GCD closures are fire and forget, so cancellation and dependencies aren't in the API.

Share a question