Skip to content

Commit 74b9421

Browse files
authored
fix progress #79 (#83)
1 parent 9d82e00 commit 74b9421

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Hub/Downloader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class Downloader: NSObject, ObservableObject {
105105
}
106106

107107
extension Downloader: URLSessionDownloadDelegate {
108-
func urlSession(_: URLSession, downloadTask: URLSessionDownloadTask, didWriteData _: Int64, totalBytesWritten _: Int64, totalBytesExpectedToWrite _: Int64) {
109-
downloadState.value = .downloading(downloadTask.progress.fractionCompleted)
108+
func urlSession(_: URLSession, downloadTask: URLSessionDownloadTask, didWriteData _: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
109+
downloadState.value = .downloading(Double(totalBytesWritten) / Double(totalBytesExpectedToWrite))
110110
}
111111

112112
func urlSession(_: URLSession, downloadTask _: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {

0 commit comments

Comments
 (0)