How to get upload progress when using:
let (data, urlResponse) = try await urlSession.upload(
for: urlRequest,
from: bodyData,
delegate: nil // Something I need here maybe?
)
I have tried using:
func urlSession(
_ session: URLSession,
task: URLSessionTask,
didSendBodyData bytesSent: Int64,
totalBytesSent: Int64,
totalBytesExpectedToSend: Int64) {
print("fractionCompleted : \(Float(totalBytesSent) / Float(totalBytesExpectedToSend))")
}
Within the same class but it never fires.
I specifically want the async / await capability on the upload.
I couldn't get the session.uploadTask to work with the await prefix.
Post
Replies
Boosts
Views
Activity
This is really a post (dig at) to the SwiftUI designers.
I have been a developer in many many different languages for far too many years. Over the last 20 I have done a lot of web (browser) development.
From the web developer perspective, developing applications that behave correctly in any browser has been a really big thing for probably more than 20 years. I even remember doing it in tables.
We are now at a stage where it does work now (mostly). Frameworks like Twitter Bootstrap work really well and so do a lot of others.
Their basic mission is that a page (view) will work no matter what the resolution (even those we don’t have yet) in an ever changing ‘view’ world.
Yet I now come to SwiftUI…
Lots of tell us your device and get your graphic designer to produce a zillion graphics for each (noting he / she isn’t a fortune teller, so they do not know what’s coming next.
After playing for days with GeometryReader and UIScreen.main.bounds (hell will that even be supported in the future) I’m not impressed.
I don’t understand why something that has been analysed and pretty much put to bed in the ‘web’ world is now attempting to be reinvented really really really really badly.
I even attempted to fix this issue with UIKit but even that wasn’t much better.
Why is a company with so much money and so many resources trying to reinvent the wheel? I don’t get it.
So much so I’m starting to tell my clients (big ones) to ditch Apple and go down far easier roots.
I doubt any of the SwiftUI compiler developers even read this stuff. But hey if you do, it’s time for a reality check…
If they don’t ha ha ha ha I rest my case.