Skip to content

Instantly share code, notes, and snippets.

@SAllen0400
Last active September 1, 2017 19:26
Show Gist options
  • Save SAllen0400/f2017de1e419a6d5ceca0a2cbebedcf1 to your computer and use it in GitHub Desktop.
Save SAllen0400/f2017de1e419a6d5ceca0a2cbebedcf1 to your computer and use it in GitHub Desktop.
Animating Progress Bar
extension UIProgressView {
func animate(duration: Double) {
setProgress(0.01, animated: true)
UIView.animate(withDuration: duration, delay: 0.0, options: .curveLinear, animations: {
self.setProgress(1.0, animated: true)
}, completion: nil)
}
}
// Animate your actual progress bar like this (10 second countdown):
progressBar.animate(duration: 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment