Repository Public MIT
1{2 "accessibility" : [3 "The system presents the alert: focus moves to it, VoiceOver reads title and message, and roles are announced by the system, not conveyed by colour alone.",4 "Escape and the cancel gesture trigger the cancel button, which validation guarantees whenever a destructive action is offered.",5 "Titles and messages are plain strings: Dynamic Type and wrapping are the system's."6 ],7 "category" : "feedback",8 "changelog" : [9 {10 "changes" : [11 "Initial release."12 ],13 "date" : "2026-12-02",14 "version" : "1.0.0"15 }16 ],17 "dependencies" : [18 {19 "id" : "glass-foundation",20 "version" : "1.0.0"21 }22 ],23 "description" : "System alert and confirmation dialog described by a value with correct button roles.",24 "examples" : [25 {26 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassAlertExample: GlassExample {\n public static let componentID = \"glass-alert\"\n @State private var alert: GlassAlert?\n @State private var outcome = \"Nothing chosen yet\"\n\n public init() {}\n\n public var body: some View {\n VStack(spacing: 16) {\n GlassButton(\"Show information\") {\n alert = GlassAlert(title: \"Export finished\", message: \"The sample file was written to Documents.\")\n }\n GlassButton(\"Unsaved changes…\") {\n alert = GlassAlert(\n title: \"Save changes?\",\n message: \"Your edits to “Budget 2027” will be lost otherwise.\",\n buttons: [\n GlassAlertButton(\"Save\") { outcome = \"Saved\" },\n .destructive(\"Discard\") { outcome = \"Discarded\" },\n .cancel { outcome = \"Cancelled\" },\n ]\n )\n }\n GlassButton(\"Delete draft…\", systemImage: \"trash\", role: .destructive) {\n // No cancel button is given: validation adds one because the only action is destructive.\n alert = GlassAlert(\n title: \"Delete this draft?\",\n message: \"This cannot be undone.\",\n style: .confirmation,\n buttons: [.destructive(\"Delete draft\") { outcome = \"Deleted\" }]\n )\n }\n Text(outcome).font(.callout).foregroundStyle(.secondary)\n }\n .padding()\n .glassAlert($alert)\n }\n}\n\n#Preview(\"GlassAlert\") { GlassAlertExample() }\n",27 "title" : "GlassAlert example"28 }29 ],30 "files" : [31 {32 "bytes" : 9366,33 "path" : "Components/Feedback/GlassAlert.swift",34 "sha256" : "dfdb049c90ed05c79aba51344c8154eef408402d1c8c9a60c134c24f6e8a8fc1"35 }36 ],37 "frameworks" : [3839 ],40 "id" : "glass-alert",41 "kind" : "native-wrapper",42 "license" : "MIT",43 "minimumOS" : {44 "iOS" : "26.0",45 "iPadOS" : "26.0",46 "macOS" : "26.0"47 },48 "name" : "GlassAlert",49 "platforms" : [50 "iOS",51 "iPadOS",52 "macOS"53 ],54 "schemaVersion" : 1,55 "sha256" : "f36f114af05cdd37a0affdebcec20cc08bb682a8caac73be9689c82bfc2a0516",56 "symbols" : [57 "GlassAlertButtonRole",58 "GlassAlertButton",59 "GlassAlertStyle",60 "GlassAlert",61 "GlassAlertValidator"62 ],63 "version" : "1.0.0"64}65