29 lines
677 B
Swift
29 lines
677 B
Swift
//
|
|
// WrappedProgressView.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 8/30/20.
|
|
// Copyright © 2020 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct WrappedProgressView: UIViewRepresentable {
|
|
typealias UIViewType = UIProgressView
|
|
|
|
let value: Double
|
|
let total: Double
|
|
|
|
func makeUIView(context: Context) -> UIProgressView {
|
|
return UIProgressView(progressViewStyle: .bar)
|
|
}
|
|
|
|
func updateUIView(_ uiView: UIProgressView, context: Context) {
|
|
if total > 0 {
|
|
uiView.setProgress(Float(value / total), animated: true)
|
|
} else {
|
|
uiView.setProgress(0, animated: true)
|
|
}
|
|
}
|
|
}
|