Repository Public MIT
1{2 "accessibility" : [3 "The editor is labelled \"Message\"; the buttons are labelled \"Attach\", \"Send\" and \"Stop\" with tooltips on macOS and 44-point targets on iOS.",4 "Chips sit in a container labelled \"Attachments\"; each remove button reads \"Remove <name>\".",5 "The text follows Dynamic Type and the bar grows with the number of lines up to the limit.",6 "With Reduce Transparency the bar is an opaque themed surface."7 ],8 "category" : "ai",9 "changelog" : [10 {11 "changes" : [12 "Initial release."13 ],14 "date" : "2026-12-02",15 "version" : "1.0.0"16 }17 ],18 "dependencies" : [19 {20 "id" : "glass-foundation",21 "version" : "1.0.0"22 }23 ],24 "description" : "Multiline prompt editor with send and stop, attachments through callbacks and keyboard shortcuts.",25 "examples" : [26 {27 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassPromptBarExample: GlassExample {\n public static let componentID = \"glass-prompt-bar\"\n @State private var draft = \"\"\n @State private var isResponding = false\n @State private var sent: [String] = []\n @State private var attachments = [\n GlassPromptAttachment(id: \"a1\", name: \"sample-report.pdf\", systemImage: \"doc.richtext\"),\n GlassPromptAttachment(id: \"a2\", name: \"a-sample-image-with-a-rather-long-file-name.png\", systemImage: \"photo\"),\n ]\n @State private var nextAttachment = 3\n\n public init() {}\n\n public var body: some View {\n VStack(alignment: .leading, spacing: 12) {\n Text(\"Sample data · nothing is sent anywhere; prompts are only listed below.\")\n .font(.caption)\n .foregroundStyle(.secondary)\n ScrollView {\n VStack(alignment: .leading, spacing: 8) {\n ForEach(Array(sent.enumerated()), id: \\.offset) { _, prompt in\n Text(prompt)\n .frame(maxWidth: .infinity, alignment: .leading)\n }\n if isResponding {\n GlassThinkingIndicator(.writing, label: \"Simulating a response\")\n }\n }\n }\n GlassPromptBar(text: $draft, placeholder: \"Ask the sample assistant\", isResponding: isResponding, attachments: attachments) { prompt in\n sent.append(prompt)\n isResponding = true\n } onStop: {\n isResponding = false\n } onAttach: {\n // A real host presents its own file importer or photo picker here.\n attachments.append(GlassPromptAttachment(id: \"a\\(nextAttachment)\", name: \"sample-\\(nextAttachment).txt\"))\n nextAttachment += 1\n } onRemoveAttachment: { attachment in\n attachments.removeAll { $0.id == attachment.id }\n }\n }\n .padding()\n .task(id: isResponding) {\n guard isResponding else { return }\n try? await Task.sleep(for: .seconds(3))\n if !Task.isCancelled { isResponding = false }\n }\n }\n}\n\n#Preview(\"GlassPromptBar\") { GlassPromptBarExample().glassTheme(.aurora) }\n",28 "title" : "GlassPromptBar example"29 }30 ],31 "files" : [32 {33 "bytes" : 12569,34 "path" : "AI/AI/GlassPromptBar.swift",35 "sha256" : "22b88d64a8945e3aa796dfe86fc000127e12fedfce06d4038d52afef72725786"36 }37 ],38 "frameworks" : [3940 ],41 "id" : "glass-prompt-bar",42 "kind" : "custom-glass",43 "license" : "MIT",44 "minimumOS" : {45 "iOS" : "26.0",46 "iPadOS" : "26.0",47 "macOS" : "26.0"48 },49 "name" : "GlassPromptBar",50 "platforms" : [51 "iOS",52 "iPadOS",53 "macOS"54 ],55 "schemaVersion" : 1,56 "sha256" : "937c7ba45733719f712498ed78de8b8ad4cf9c82c84f97491d883e765de261f0",57 "symbols" : [58 "GlassPromptAttachment",59 "GlassPromptInput",60 "ReturnKeyAction",61 "GlassPromptBar"62 ],63 "version" : "1.0.0"64}65