Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Examples/Gallery/Buttons/GlassButtonExample.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 GlassButtonExample: GlassExample {45 public static let componentID = "glass-button"46 @State private var isSaving = false47 @State private var saveCount = 04849 public init() {}5051 public var body: some View {52 VStack(spacing: 16) {53 GlassButton("Save changes", systemImage: "checkmark", variant: .prominent, isLoading: isSaving) {54 isSaving = true55 saveCount += 156 }57 GlassButton("Duplicate", systemImage: "plus.square.on.square") { saveCount += 1 }58 GlassButton("Delete draft", systemImage: "trash", role: .destructive) { saveCount = 0 }59 GlassButton("Unavailable", size: .small) {}60 .disabled(true)61 GlassButton(variant: .regular, size: .large) {62 isSaving = false63 } label: {64 VStack {65 Text("Reset")66 Text("Saved \(saveCount) times").font(.caption)67 }68 }69 }70 .padding()71 }72}7374#Preview("GlassButton") { GlassButtonExample().glassTheme(.aurora) }75