SPB Git

Repository Public MIT

GlassProgressExample.swift 2.6 KB 74 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project          : SP GlassKit7// File             : Examples/Gallery/Feedback/GlassProgressExample.swift8// Module           : Examples9// Repository       : https://git.spboucher.ai/sp-glasskit10// Project Website  : https://glass.spboucher.ai11// Created          : 2026-12-0212// Last Modified    : 2026-12-0213//14// Author           : Simon-Pierre Boucher15// Position         : Professor of Finance16// Institution      : Université du Québec en Outaouais (UQO)17// Organization     : SP Boucher18// Website          : https://spboucher.ai19// Git              : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development      : dev@spboucher.ai23// Support          : support@spboucher.ai24// Security/Admin   : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License          : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import SwiftUI42import SPGlassKit4344public struct GlassProgressExample: GlassExample {45    public static let componentID = "glass-progress"46    @State private var uploaded = 30.047    @State private var isCancelled = false4849    public init() {}5051    public var body: some View {52        VStack(alignment: .leading, spacing: 20) {53            if isCancelled {54                Text("Upload cancelled").foregroundStyle(.secondary)55            } else {56                GlassProgress("Uploading sample.pdf", value: uploaded, total: 120, onCancel: { isCancelled = true })57            }58            GlassProgress("Storage used", value: 0.82, style: .circular)59            GlassProgress("Connecting")60            GlassProgress(style: .circular)61            HStack {62                GlassButton("Add 30 MB") { uploaded += 30 }63                GlassButton("Restart") {64                    uploaded = 065                    isCancelled = false66                }67            }68        }69        .padding()70    }71}7273#Preview("GlassProgress") { GlassProgressExample() }74
Files main
Menu

Theme