Caps-iOS/Caps/Views/ClassifierDownloadView.swift

24 lines
698 B
Swift
Raw Normal View History

2023-10-24 14:51:08 +02:00
import SwiftUI
struct ClassifierDownloadView: View {
@ObservedObject
var progress: Database.ClassifierProgress
var body: some View {
VStack {
ProgressView("Downloading classifier...", value: progress.bytesLoaded, total: Double(progress.total))
.progressViewStyle(.linear)
HStack {
Text(String(format: "%.0f %%", progress.percentage))
Spacer()
Text(String(format: "%.1f / %.1f MB", progress.bytesLoaded / 1_000_000, progress.total / 1_000_000 ))
}
}
}
}
#Preview {
ClassifierDownloadView(progress: .init(bytesLoaded: 12_300_000, total: 24_500_000))
}