Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Timer label is not visible when UICircularTimerRing is animating #171

Closed
tomerciucran opened this issue Feb 25, 2019 · 11 comments · Fixed by #172
Closed

Timer label is not visible when UICircularTimerRing is animating #171

tomerciucran opened this issue Feb 25, 2019 · 11 comments · Fixed by #172
Labels

Comments

@tomerciucran
Copy link
Contributor

Bug Report

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

Version

6.0.0

Overview of what you tried to do

Implement a UICircularTimerRing with a custom formatter.

What is the expected outcome?

the circle ring being animated and the timer label displaying each second as expected.

What is the actual outcome?

the label in the middle of the circle is only visible before the animation starts and after it finishes.
Could be related to the gradient changes on the last update because it was working fine on 5.1.0. Same result with or without a custom value formatter.

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.

class ExerciseBreakCircularRingValueFormatter: UICircularRingValueFormatter {
    let totalDuration: CGFloat
    
    init(totalDuration: CGFloat) {
        self.totalDuration = totalDuration
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func string(for value: Any) -> String? {
        guard let value = value as? CGFloat else { return nil }
        let interval = totalDuration - value
        let minutes = Int(interval) / 60 % 60
        let seconds = Int(interval) % 60
        return String(format: "%02i:%02i", minutes, seconds)
    }
}

class ExerciseBreakViewController: UIViewController, Pausable {
   @IBOutlet weak var progressView: UICircularTimerRing! {
        didSet {
            progressView.font = Fonts.getFont(type: .headlineBold)
            progressView.valueFormatter = ExerciseBreakCircularRingValueFormatter(totalDuration: CGFloat(viewModel.duration.value))
        }
    }

   override func viewDidAppear(_ animated: Bool) {
      self.progressView.startTimer(to: duration) { [weak self] state in
                guard let `self` = self else { return }
                switch state {
                case .finished:
                    self.delegate?.exerciseItemDidEnd(exercise: self.viewModel)
                default: break
                }
            }
   }
}

Have you tried fixing this yourself?

This project is open source, and I'm a student with very minimal amount of time.
Please give an attempt at fixing the issue first before creating a bug report.
This saves everyone time and benefits anyone who uses the library.
Pull requests are welcome!

@oztiryakimeric
Copy link

Same here. I don't even use value formatter.

@luispadron
Copy link
Owner

weird, i’ll take a look this weekend

@luispadron luispadron added the bug label Feb 25, 2019
@luispadron luispadron changed the title timer label is not visible when UICircularTimerRing is animating Timer label is not visible when UICircularTimerRing is animating Feb 25, 2019
luispadron added a commit that referenced this issue Feb 25, 2019
@luispadron
Copy link
Owner

Fixed in v6.0.1, thanks for reporting this!

@hohteri
Copy link

hohteri commented Feb 27, 2019

At least carthage build v6.0.1 still has this bug, doesn't exist on master though.

@luispadron
Copy link
Owner

must’ve uploaded the wrong built framework then, i’ll upload the correct one when i get a chance

@luispadron
Copy link
Owner

@hohteri could you verify this is fixed for Carthage now? I built a new framework.zip and am curious if that was the issue.

@hohteri
Copy link

hohteri commented Feb 28, 2019

Unfortunately the issue still remains. It also still downloads v6.0.1 in case that piece of information is of any use. Master branch works as expected.

@luispadron
Copy link
Owner

it’s still v6.0.1 i just re uploaded the binary, maybe carthage is caching it?

@hohteri
Copy link

hohteri commented Feb 28, 2019

I used it on laptop which I never had downloaded the library before. I’ll retest on my desktop

@luispadron
Copy link
Owner

@hohteri should be fixed now, just tested it. You may have to do rm -rf Carthage and Carthage update --platform iOS again

@hohteri
Copy link

hohteri commented Feb 28, 2019

Yes, now it works. Thank you!

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

Successfully merging a pull request may close this issue.

4 participants