Pick the fix
Without async/await, you need: at most 3 downloads at once, unzip only after its download, and cancel all when the user leaves. Which fits best?
Hint 1 of 1
Which API has dependencies built in?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: B OperationQueue with maxConcurrentOperationCount = 3 and dependencies
Correct. It provides all three features.
Why not the others?
- A A concurrent DispatchQueue. It has no dependencies, no limit and no way to cancel queued work.
- C DispatchSemaphore(value: 3) around a global queue. It limits concurrency by blocking threads, and has no dependencies or cancellation.
- D A Thread per file. Threads are expensive and give you none of these features.