More detail on .backgroundTask(.urlSession("isStormy")) shown at 11:50

In the slides at 11:50 the following code snippet is shown:

.backgroundTask(.urlSession("isStormy")) {
    // ...
}

Please could you explain what should be done in this block? The video just cuts off right after and seems like the explanation is missing. Thanks.

Post not yet marked as solved Up vote post of malc Down vote post of malc
179 views

Replies

I too wonder how do we get at the downloaded data from the background task?

The URLSessionDownloadTask documentation says that "Download tasks directly write the server’s response data to a temporary file…", but it does not explain how to find out where this file lives once the download is completed by the new SwiftUI backgroundTask API.

I would also really like to know this! All I can think of is getting all the tasks from the urlSession and iterating through them.