Then icon indicating copy to clipboard operation
Then copied to clipboard

.progress should be able to return Progress, not Float

Open subdiox opened this issue 4 years ago • 1 comments

Currently, this library can only return Float value when using .progress directive. However, Alamofire and other network libraries return Progress instance instead of Float.

I think thenPromise should be able to return Progress instance on .progress directive. For example:

return Promise<URL> { resolve, reject, progress in
    Alamofire.download(escapedUrl, to: destination)
        .downloadProgress { downloadProgress in // downloadProgress is Progress class
            // let currentProgress = Float(downloadProgress.completedUnitCount) / Float(downloadProgress.totalUnitCount)
            // progress(currentProgress)
            progress(downloadProgress) // <- should be able to write like this
        }
        .response { response in
            ...
        }
}

subdiox avatar Jul 11 '19 14:07 subdiox

@subdiox Thanks for the suggestion, I wasn't very familiar with the Progress object. This seems like a good addition to me.

s4cha avatar Dec 13 '19 08:12 s4cha