Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Examples/Gallery/Feedback/GlassBadgeExample.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 GlassBadgeExample: GlassExample {45 public static let componentID = "glass-badge"46 @State private var unread = 74748 public init() {}4950 public var body: some View {51 VStack(alignment: .leading, spacing: 16) {52 HStack(spacing: 12) {53 Text("Inbox")54 GlassBadge(count: unread)55 Spacer()56 Stepper("Unread", value: $unread, in: -1...150, step: 31).labelsHidden()57 }58 HStack(spacing: 12) {59 GlassBadge("New", tone: .accent)60 GlassBadge("Beta")61 GlassBadge("−12 %", tone: .critical)62 GlassBadge(count: 0, showsZero: true, tone: .neutral)63 }64 VStack(alignment: .leading, spacing: 8) {65 GlassBadge(status: "Online", tone: .success)66 GlassBadge(status: "Degraded", tone: .warning)67 GlassBadge(status: "Offline", tone: .critical)68 GlassBadge(status: "Unknown", tone: .neutral)69 }70 }71 .padding()72 }73}7475#Preview("GlassBadge") { GlassBadgeExample().glassTheme(.aurora) }76