SPB Git

Repository Public MIT

example-glass-progress.txt 1.0 KB 34 lines text

1import SwiftUI2import SPGlassKit34public struct GlassProgressExample: GlassExample {5    public static let componentID = "glass-progress"6    @State private var uploaded = 30.07    @State private var isCancelled = false89    public init() {}1011    public var body: some View {12        VStack(alignment: .leading, spacing: 20) {13            if isCancelled {14                Text("Upload cancelled").foregroundStyle(.secondary)15            } else {16                GlassProgress("Uploading sample.pdf", value: uploaded, total: 120, onCancel: { isCancelled = true })17            }18            GlassProgress("Storage used", value: 0.82, style: .circular)19            GlassProgress("Connecting")20            GlassProgress(style: .circular)21            HStack {22                GlassButton("Add 30 MB") { uploaded += 30 }23                GlassButton("Restart") {24                    uploaded = 025                    isCancelled = false26                }27            }28        }29        .padding()30    }31}3233#Preview("GlassProgress") { GlassProgressExample() }34
Files main
Menu

Theme