Tusker/Tusker/Views/SteppedProgressView.swift

31 lines
613 B
Swift

//
// SteppedProgressView.swift
// Tusker
//
// Created by Shadowfacts on 9/11/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import UIKit
class SteppedProgressView: UIProgressView {
var currentStep: Int = 0 {
didSet {
guard steps > 0 else { return }
let progress = Float(currentStep) / Float(steps)
DispatchQueue.main.async {
self.setProgress(progress, animated: true)
}
}
}
var steps: Int = 0
func step() {
if currentStep < steps {
currentStep += 1
}
}
}