luispadron / UICircularProgressRing

A circular progress bar for iOS written in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Progress not changing when called from a delegate callback.

MANassar opened this issue · comments

Bug Report

⚠️ Your issue will be closed if these are not filled out. ⚠️

Version

6.1.0

Overview of what you tried to do

Tried to update the progress from within a callback from a URLSessionDelegate

What is the expected outcome?

Progress should have been updated

What is the actual outcome?

Nothing happens. Although the completion block reports the correct value.

Post sample code or example here

If sample code can't be provided because it's too long, please provide a small example project,
where I can test, if you cannot provide either. There is not much I can do.

func uploadProgressUpdate(uploadTask: URLSessionTask, percentUploaded: Float)
    {
        DispatchQueue.main.async {
            self.progressRing.startProgress(to: CGFloat(percentUploaded), duration: 2) {
                print("Done animating! Value = \(self.progressRing.value)")
            }
        }
    }

Have you tried fixing this yourself?

I tried to debug the startAnimation method, but it seems to be running fine. I didnt invest much time into it tbh as I'm short on time myself.

hm that is odd, since you're updating on the main thread it should work. I'll take a closer look

So I tested this and I cant reproduce the issue you're having, have you verified that CGFloat(percentUploaded) is indeed changing?