Caps-iOS/Caps/Views/ClassifierDownloadView.swift

26 lines
687 B
Swift
Raw Normal View History

2023-10-24 14:51:08 +02:00
import SwiftUI
struct ClassifierDownloadView: View {
let progress: ClassifierProgress
2023-10-24 14:51:08 +02:00
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)
)
2023-10-24 14:51:08 +02:00
}