Repository Public MIT
1{2 "accessibility" : [3 "One element per pin. Its label is the title, or the marker text when there is no title; clusters read \"132 places\" (after the title if there is one).",4 "A selected pin has the `.isSelected` trait; selection is also visible by size, outline and the title, not by colour.",5 "The marker grows with Dynamic Type (`@ScaledMetric`)."6 ],7 "category" : "maps",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" : "Configurable marker with selection and an accessible label; clustering is left to the map engine.",24 "examples" : [25 {26 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassMapPinExample: GlassExample {\n public static let componentID = \"glass-map-pin\"\n\n private struct Place: Identifiable {\n let id: String\n let title: String\n let content: GlassMapPinContent\n let tint: GlassColorToken\n /// Position in the unit square of the placeholder map.\n let position: UnitPoint\n }\n\n /// Fictitious places.\n private let places = [\n Place(id: \"cafe\", title: \"Café Exemple\", content: .symbol(\"cup.and.saucer.fill\"), tint: .primary, position: UnitPoint(x: 0.25, y: 0.3)),\n Place(id: \"museum\", title: \"Musée fictif des très longs noms de lieux\", content: .symbol(\"building.columns.fill\"), tint: .accent, position: UnitPoint(x: 0.7, y: 0.25)),\n Place(id: \"price\", title: \"Listing A-12\", content: .text(\"$1.2M\"), tint: .success, position: UnitPoint(x: 0.5, y: 0.55)),\n Place(id: \"warning\", title: \"Road works\", content: .symbol(\"exclamationmark.triangle.fill\"), tint: .warning, position: UnitPoint(x: 0.2, y: 0.75)),\n ]\n @State private var selection: String? = \"cafe\"\n\n public init() {}\n\n public var body: some View {\n GeometryReader { proxy in\n SampleMapBackdrop()\n .overlay {\n ForEach(places) { place in\n Button {\n selection = selection == place.id ? nil : place.id\n } label: {\n GlassMapPin(place.content, title: place.title, tint: place.tint, isSelected: selection == place.id)\n }\n .buttonStyle(.plain)\n .position(x: proxy.size.width * place.position.x, y: proxy.size.height * place.position.y)\n }\n // Cluster markers: the count comes from the map engine, the pin only formats it.\n GlassMapPin(clusterCount: 12)\n .position(x: proxy.size.width * 0.8, y: proxy.size.height * 0.6)\n GlassMapPin(clusterCount: 1_340, title: \"Downtown\")\n .position(x: proxy.size.width * 0.75, y: proxy.size.height * 0.8)\n }\n }\n }\n}\n\n#Preview(\"GlassMapPin\") { GlassMapPinExample().glassTheme(.solar) }\n",27 "title" : "GlassMapPin example"28 }29 ],30 "files" : [31 {32 "bytes" : 7309,33 "path" : "Maps/Maps/GlassMapPin.swift",34 "sha256" : "47dce6811d4fa371818920093be9a8bb4cb871df50e4b66209792fad002369f0"35 }36 ],37 "frameworks" : [3839 ],40 "id" : "glass-map-pin",41 "kind" : "content-component",42 "license" : "MIT",43 "minimumOS" : {44 "iOS" : "26.0",45 "iPadOS" : "26.0",46 "macOS" : "26.0"47 },48 "name" : "GlassMapPin",49 "platforms" : [50 "iOS",51 "iPadOS",52 "macOS"53 ],54 "schemaVersion" : 1,55 "sha256" : "40b7a42b61359aa4696cc040cd09ab32b6fd1d9a19b159512b6428620eea64f9",56 "symbols" : [57 "GlassMapPinContent",58 "GlassMapPinFormatting",59 "GlassMapPin"60 ],61 "version" : "1.0.0"62}63