A vertical progress view created from UIProgressView.
import VerticalProgressView
class ViewController: UIViewController {
let verticalProgressView: VerticalProgressView = {
let progressView = VerticalProgressView()
progressView.translatesAutoresizingMaskIntoConstraints = false
return progressView
}()
override func viewDidLoad() {
super.viewDidLoad()
addVerticalProgressView()
verticalProgressView.setProgress(0.7, animated: false)
}
private func addVerticalProgressView() {
view.addSubview(verticalProgressView)
verticalProgressView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
verticalProgressView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
verticalProgressView.widthAnchor.constraint(equalToConstant: 6).isActive = true
verticalProgressView.heightAnchor.constraint(equalTo: view.heightAnchor, multiplier: 0.7).isActive = true
}
}
Alternatively you can add a UIView and storyboard and set its class to VerticalProgressView, and play constraints there.
Moreover if you dont want to use AutoLayout, simply add it like:
override func viewDidLoad() {
super.viewDidLoad()
let verticalProgressView = VerticalProgressView(frame: CGRect(x: 30, y: 30, width: 6, height: 100))
view.addSubview(verticalProgressView)
verticalProgressView.setProgress(0.7, animated: false)
}
// Make the progress view descending
verticalProgressView.isAscending = false // Defaults to true
// Set progress image
verticalProgressView.progressImage = UIImage(named: "ProgressImage.png")
// Read progress
let progress = verticalProgressView.progress
// Set progress
verticalProgressView.setProgress(0.6, animated: true) // Perform on main thread
// Set progress tint color
verticalProgressView.progressTintColor = .red
// Set progress view style
verticalProgressView.progressViewStyle = .bar
// Set track image
verticalProgressView.trackImage = UIImage(named: "TrackImage.png")
// Set track tint color
verticalProgressView.trackTintColor = .darkGray
VerticalProgressView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "VerticalProgressView"
Muhammad Naeem Jawaid, naeemjawaid@gmail.com
VerticalProgressView is available under the MIT license. See the LICENSE file for more info.