Hi Matt Eaton,
I know that this is an older post, but hoped you would be willing to update your NetworkSessionManager example for swiftui?
The
protocol NetworkDisplay: class {
		func updateUI(response: String)
}
Is the real sticky point.
For example if we have a view like:
struct ReadingsRow: View {
		@ObservedObject var viewModel: ListingViewModel
		@EnvironmentObject var env: GlobalEnvironment
		var reading: Reading
	 @State var progressValue: Float = 0.25
		var body: some View {
				VStack {
						HStack{
								Text("\(reading.title!)")
										.font(.custom("Helvetica Neue", size: 16))
										.fontWeight(.semibold)
								Button(action: {
										let videoToDownload = Download(reading: self.reading)
										self.viewModel.downloadVimeoVideo(downloadObj: videoToDownload)
								}) {
										 Image(systemName: "arrow.down.left.video")
								}
						}
						HStack {
							 VStack {
										ProgressBar(value: $progressValue).frame(height: 5)
										Spacer()
								}.padding()
						}
				}.onAppear() {
						print("isOnline", self.env.getOnlineStatus())
				}
		}
}
Here is the class method that self.viewModel.dowladVimeoVideo() uses:
class BackgroundDownloadTasks{
		/// Get local file path: download task stores tune here; AV player plays it.
		let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
		func downloadVideoInBackground(downloadVideo: Download) {
				let bgHeaders = mmHeaders(
					 ContentType: "application/video",
					 HttpMethod: "POST",
					 Authorization: "<--Bearer Token Here-->"
				)
				let ST = SessionTasks(url: downloadVideo.url)
				let NSM = NetworkSessionManager(withBackgroundSession: "com.somethingunique", delegate: <#NetworkDisplay#>)
				let bkgRequest = ST.getRequest(mmHeaders: bgHeaders)
				NSM.downloadWithFile(with: downloadVideo.url.absoluteString, from: bkgRequest)
		}
}
I realize that the $progressValue state variable will not work in my example as each ReadingRow has to have a unique progressBar value. However, ignoring this, how would we make use of updateUI() to set the $progressValue in the ProgressBar(value: progressValue).frame(height: 5)?
Best Regards,
Steve Browning