Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Examples/Gallery/AI/GlassThinkingIndicatorExample.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 GlassThinkingIndicatorExample: GlassExample {45 public static let componentID = "glass-thinking-indicator"4647 /// Fictitious activity labels, written by the host — never text coming from a model.48 private let stages: [(kind: GlassActivityKind, label: String)] = [49 (.thinking, "Preparing the sample answer"),50 (.searching, "Searching the sample library"),51 (.reading, "Reading 3 sample documents"),52 (.writing, "Writing the summary"),53 (.waiting, "Waiting for your confirmation"),54 ]55 @State private var stage = 05657 public init() {}5859 public var body: some View {60 VStack(alignment: .leading, spacing: 16) {61 Text("Sample data · simulated activity")62 .font(.caption)63 .foregroundStyle(.secondary)6465 GlassThinkingIndicator(stages[stage].kind, label: stages[stage].label)66 GlassButton("Next activity", systemImage: "forward.end") {67 stage = (stage + 1) % stages.count68 }6970 Divider()71 ForEach(stages.indices, id: \.self) { index in72 GlassThinkingIndicator(stages[index].kind, label: stages[index].label, announcesChanges: false)73 }74 GlassThinkingIndicator(.custom(systemImage: "arrow.down.circle"), label: "Downloading the sample model, which has a long label that wraps on narrow screens", announcesChanges: false)75 GlassThinkingIndicator(announcesChanges: false)7677 Divider()78 Text("Reduce Motion (simulated): static symbol")79 .font(.caption)80 GlassThinkingIndicator(.searching, label: "Searching the sample library", announcesChanges: false)81 .glassSimulatedAccessibility(reduceMotion: true)82 }83 .padding()84 }85}8687#Preview("GlassThinkingIndicator") { GlassThinkingIndicatorExample().glassTheme(.crystal) }88