Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.progress should be able to return Progress, not Float #55

Open
subdiox opened this issue Jul 11, 2019 · 1 comment
Open

.progress should be able to return Progress, not Float #55

subdiox opened this issue Jul 11, 2019 · 1 comment

Comments

@subdiox
Copy link

subdiox commented Jul 11, 2019

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
            ...
        }
}
@s4cha
Copy link
Member

s4cha commented Dec 13, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants