Modern Concurrency Chapter 3: private func downloadWithProgress

This method always receives nil for the offset. Consequently, partial downloads are never executed, even in the final and challenge versions of the project.

Verified by adding these print statements:

    if let offset = offset {
...
	print("Using partial download...")
    } else {
...
	print("Using full download...")
    }

Can you please provide more detailed steps how to reproduce this issue?

Here’s what I’m doing: I’m using the “challenge” project folder for Chapter 3, when I add a breakpoint right after if let offset = offset { the debugger breaks right there:

Thanks for the quick reply!
Turns out, I was confused. I had progressed only as far as implementing and testing the Gold button plan. The code for implementing the Gold button plan has us writing both the if let offset = offset block as well as the else part of that block, but the if part is not used by the Gold plan – that code is only executed by the not-yet covered Cloud 9 plan. It seems like the tutorial usually only asks us to write code that we need for the specific topic at hand, not code that will be required by later functionality – so I was confused. Other than that, I’ve found this tutorial very clear and well-written, and I’ve learned a lot about the modern way to write async Swift code. Thanks again.

1 Like