SPB Git

Repository Public MIT

manifest.json 4.0 KB 68 lines json

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        "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      "id" : "glass-icon-button",25      "version" : "1.0.0"26    }27  ],28  "description" : "Location action with injected state; permission is requested by the host application only.",29  "examples" : [30    {31      "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",32      "title" : "GlassLocationButton example"33    }34  ],35  "files" : [36    {37      "bytes" : 6382,38      "path" : "Maps/Maps/GlassLocationButton.swift",39      "sha256" : "71d0310a8305f900f1e7821ef651d2a5c8011d126e143b13497143d1c511b0fd"40    }41  ],42  "frameworks" : [4344  ],45  "id" : "glass-location-button",46  "kind" : "custom-glass",47  "license" : "MIT",48  "minimumOS" : {49    "iOS" : "26.0",50    "iPadOS" : "26.0",51    "macOS" : "26.0"52  },53  "name" : "GlassLocationButton",54  "platforms" : [55    "iOS",56    "iPadOS",57    "macOS"58  ],59  "schemaVersion" : 1,60  "sha256" : "dc8c920cf0352957260ac9589d2441903ea91ecb858510bccfe48091c078ff5f",61  "symbols" : [62    "GlassLocationState",63    "GlassLocationPresentation",64    "GlassLocationButton"65  ],66  "version" : "1.0.0"67}68
Files main
Menu

Theme