Can progress reporting be added to this style of https transfer?
I've asked several AI chatbots and none of their attempts have worked. I'm guessing I should be using the old dataTask ways to do this and that trying to do it with
async
/await
isn't really implemented/supported yet. But even though I'm an old programmer I'm very new to the Apple ecosystem.2 Replies
the code I started with was using a semaphore and I either assumed or read that was the old way and these days I should use
async
/await
. Other examples I can find are for GUI apps (I'm doing commandline); or they used RunLoop
, which I also assumed would be outdated
I'm assuming i'm going to need a delegate. but so for i've only used those in gui apps and i haven't found an example yet how to make/use one for my case
the answer is yes
instead of
use
then you can read the bytes byte-by-byte or line-by-line or probably other ways
or
then you can report progress either for each one, or keep track of how many calls/bytes/lines/etc or time elapsed to decide how often report progressbut it seems to actually be less effort to use the old continuation method and both ways are equally fast. here's the great answer I got on Stack Overflow
https://stackoverflow.com/a/77072098/527702
Stack Overflow
Modern way for macOS commandline code to fetch data in Swift, with ...
Old programmer but new to Apple ecosystem. I want to use the most modern APIs and Swift techniques to fetch some data over https and get progress reports.
Most tutorials and examples I can find use