Last active
September 1, 2017 19:26
-
-
Save SAllen0400/f2017de1e419a6d5ceca0a2cbebedcf1 to your computer and use it in GitHub Desktop.
Animating Progress Bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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