Repository Public MIT
1{2 "accessibility" : [3 "The label is the state itself (\"Location access denied\"), so VoiceOver announces it without relying on the symbol.",4 "Denied and unavailable use a slashed symbol and their own label — never colour alone.",5 "`hint` becomes the accessibility hint; while locating the button has the \"updates frequently\" trait.",6 "The target is at least 44 points on iOS and iPadOS."7 ],8 "category" : "maps",9 "changelog" : [10 {11 "changes" : [12 "Release 1.1.0: see the project changelog."13 ],14 "date" : "2026-12-03",15 "version" : "1.1.0"16 },17 {18 "changes" : [19 "Initial release."20 ],21 "date" : "2026-12-02",22 "version" : "1.0.0"23 }24 ],25 "dependencies" : [26 {27 "id" : "glass-foundation",28 "version" : "1.1.0"29 },30 {31 "id" : "glass-icon-button",32 "version" : "1.1.0"33 }34 ],35 "description" : "Location action with injected state; permission is requested by the host application only.",36 "examples" : [37 {38 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassLocationButtonExample: GlassExample {\n public static let componentID = \"glass-location-button\"\n /// The example plays the host's role with a simulated state: no permission is requested, no position is read.\n @State private var state = GlassLocationState.idle\n @State private var message = \"Sample data · simulated states, no location access\"\n\n public init() {}\n\n public var body: some View {\n VStack(spacing: 16) {\n SampleMapBackdrop()\n .overlay(alignment: .bottomTrailing) {\n GlassLocationButton(state: state, hint: hint) { advance() }\n .padding()\n }\n Picker(\"Simulated state\", selection: $state) {\n ForEach(GlassLocationState.allCases, id: \\.self) { state in\n Text(GlassLocationPresentation(state).label).tag(state)\n }\n }\n .padding(.horizontal)\n HStack(spacing: 12) {\n ForEach(GlassLocationState.allCases, id: \\.self) { state in\n GlassLocationButton(state: state, size: .small) {}\n }\n }\n Text(message)\n .font(.caption)\n .foregroundStyle(.secondary)\n .padding(.horizontal)\n }\n .padding(.bottom)\n }\n\n private var hint: String? {\n switch state {\n case .denied: \"Location access was refused. Activating the button would open Settings in a real application.\"\n case .unavailable: \"Location services are off on this device.\"\n default: nil\n }\n }\n\n /// What a host might do on a tap, simulated.\n private func advance() {\n switch state {\n case .idle:\n state = .locating\n message = \"The host would start location updates here.\"\n case .locating:\n state = .following\n message = \"A position arrived: the map follows it.\"\n case .following:\n state = .idle\n message = \"Following stopped.\"\n case .denied:\n message = \"The host would open Settings here.\"\n case .unavailable:\n break\n }\n }\n}\n\n#Preview(\"GlassLocationButton\") { GlassLocationButtonExample().glassTheme(.emerald) }\n",39 "title" : "GlassLocationButton example"40 }41 ],42 "files" : [43 {44 "bytes" : 8017,45 "path" : "Maps/Maps/GlassLocationButton.swift",46 "sha256" : "98a116afebfa442796986c673c9229db0896283c4b2126b73a543b3910395388"47 }48 ],49 "frameworks" : [5051 ],52 "id" : "glass-location-button",53 "kind" : "custom-glass",54 "license" : "MIT",55 "minimumOS" : {56 "iOS" : "26.0",57 "iPadOS" : "26.0",58 "macOS" : "26.0"59 },60 "name" : "GlassLocationButton",61 "platforms" : [62 "iOS",63 "iPadOS",64 "macOS"65 ],66 "schemaVersion" : 1,67 "sha256" : "e9492c13529bcd07a91d35923361dedc007f66609da9eda5f35b72752bf280f4",68 "symbols" : [69 "GlassLocationState",70 "GlassLocationPresentation",71 "GlassLocationButton"72 ],73 "version" : "1.1.0"74}75