mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-04-08 11:15:51 +00:00
This more closely replicates the default look and feel of SwiftUI.ProgressView, but with explicit control over whether localizedAdditionalDescription is shown and without the label above the progress view that displays a fileOperationKind string.
36 lines
1.2 KiB
Swift
36 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
struct InstallationStepDetailView: View {
|
|
let installationStep: InstallationStep
|
|
|
|
var body: some View {
|
|
VStack {
|
|
switch installationStep {
|
|
case let .downloading(progress):
|
|
Text("Step \(installationStep.stepNumber) of \(installationStep.stepCount): \(installationStep.message)")
|
|
.font(.title2)
|
|
ObservingProgressIndicator(
|
|
progress,
|
|
controlSize: .regular,
|
|
style: .bar,
|
|
showsAdditionalDescription: true
|
|
)
|
|
|
|
case .unarchiving, .moving, .trashingArchive, .checkingSecurity, .finishing:
|
|
ProgressView()
|
|
.scaleEffect(0.5)
|
|
}
|
|
}
|
|
.frame(minWidth: 80)
|
|
}
|
|
}
|
|
|
|
struct InstallDetailView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
InstallationStepDetailView(
|
|
installationStep: .downloading(
|
|
progress: configure(Progress(totalUnitCount: 100)) { $0.completedUnitCount = 40; $0.throughput = 9211681; $0.fileCompletedCount = 84844492; $0.fileTotalCount = 11944848484 }
|
|
)
|
|
)
|
|
}
|
|
}
|