24 lines
698 B
Swift
24 lines
698 B
Swift
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))
|
|
}
|