luispadron / UICircularProgressRing

A circular progress bar for iOS written in Swift
MIT License
1.73k stars 290 forks source link

How to get time from UICircularTimerRing? #231

Closed m-tatsuto closed 4 years ago

m-tatsuto commented 4 years ago

Can't get progress time. I am calling continueTimer() by force, but Debug logs are noisy

        self.progressUpdateTimer = Timer.scheduledTimer(withTimeInterval: 0.2, repeats: true, block: { (timer) in
            self.searchProgress.continueTimer()
        })
       searchProgress.startTimer(to: maxtime) { (state) in
            switch state {
            case .finished:
                self.searchProgress.resetTimer()
                self.progressTimer()

            case .continued(let time):
                let remainTime = Int(maxtime) - Int(time ?? 0)
                self.searchProgressInfoLabel.text = "\(remainTime)s"
            default:
                break
            }
        }
luispadron commented 4 years ago

Not sure what you are asking here, in the continued state time is the current time of the ring.

luispadron commented 4 years ago

You should also only call continueTimer after pauseTimer, if you want to reset the timer call resetTimer

m-tatsuto commented 4 years ago

I want to get the remaining time while the ring is spinning. I can't find way