macOS load file progress indication

My app generates many files as large as 12 GB (limited by memory) and I use Picker() to select which to reload with FileManager(). The larger files can take three minutes to load (M2 Mini Pro) and it would be nice to have progress indication like Apple's App Store downloads with the mini spinner, file size and bytes loaded.

From what I've read in "Developer Documentation", I must use a URLdelegate instance I have created, not the shared delegate, when effecting a URL download. "Downloading files in the Background" shows iOS code, not macOS, and it also uses a "shared" delegate.

A post, here, dated years ago said what I seek is not possible and I have not found recent sample code to show otherwise.

Can anyone shed light on this?
Thanks

Replies

If you’re accessing the files as files then URLSession is a red herring.

There is a file URL resource values that can return this information. See the docs for the .ubiquitousItemDownloadingStatusKey key.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I see keys: current, downloaded, and notDownloaded, but no variables for progress. The spinning beachball will have to do. Thanks for letting me know that URLSession was a dead end though.

Add a Comment