SPB Git

Repository Public MIT

doc-glass-thinking-indicator.md 2.4 KB

# GlassThinkingIndicator

Identifier glass-thinking-indicator
Module SPGlassAI
Kind content-component — a symbol and a text; no surface
Platforms iOS 26, iPadOS 26, macOS 26
Example Examples/Gallery/AI/GlassThinkingIndicatorExample.swift

UI only. The indicator states an activity in the host's words. It never displays reasoning, intermediate thoughts or any text the host did not pass as label.

# Minimal usage

swift
GlassThinkingIndicator(.searching, label: "Searching the documentation")

# Variants

Kind Symbol
.thinking sparkles
.searching magnifyingglass
.reading doc.text.magnifyingglass
.writing pencil.line
.waiting hourglass
.custom(systemImage:) Any SF Symbol

The kind only selects the symbol. The words always come from label; without a label the indicator reads "Working".

# Parameters

Parameter Type Default Meaning
kind GlassActivityKind .thinking Selects the symbol.
label String? nil → "Working" What is happening, written by the host.
announcesChanges Bool true Posts a low-priority accessibility announcement when the label changes.

# States

The indicator is either on screen (activity in progress) or not: remove it when the activity ends. With Reduce Motion the symbol is static.

# Advanced example

swift
if let activity = agent.currentActivity {          // host type: { kind, label }
    GlassThinkingIndicator(activity.kind, label: activity.label)
        .transition(.opacity)
}

# Accessibility

  • Symbol and text form one element with the "updates frequently" trait; the symbol is decorative.
  • A change of label is announced with AccessibilityNotification.Announcement at low priority, so it never interrupts speech in progress. Blank and unchanged labels are not announced.
  • The pulse is a symbol effect that is disabled with Reduce Motion (real or simulated).

# Limits

  • The symbol pulses for as long as the view is on screen: showing it while nothing happens would be an idle animation. Tie its presence to real activity.
  • There is no elapsed time, progress value or step list; use GlassAgentPanel or GlassProgress for those.
  • Announcements were compiled but not heard with VoiceOver during verification; the rule deciding when to announce is unit-tested.
Files main
Menu

Theme