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 "Release 1.1.0: see the project changelog."12 ],13 "date" : "2026-12-03",14 "version" : "1.1.0"15 },16 {17 "changes" : [18 "Initial release."19 ],20 "date" : "2026-12-02",21 "version" : "1.0.0"22 }23 ],24 "dependencies" : [25 {26 "id" : "glass-foundation",27 "version" : "1.1.0"28 }29 ],30 "description" : "Configurable marker with selection and an accessible label; clustering is left to the map engine.",31 "examples" : [32 {33 "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",34 "title" : "GlassMapPin example"35 }36 ],37 "files" : [38 {39 "bytes" : 11563,40 "path" : "Maps/Maps/GlassMapPin.swift",41 "sha256" : "34af5140ae297212878beab2ce798ee4baf6648fe78db8c9614231a674621742"42 }43 ],44 "frameworks" : [4546 ],47 "id" : "glass-map-pin",48 "kind" : "content-component",49 "license" : "MIT",50 "minimumOS" : {51 "iOS" : "26.0",52 "iPadOS" : "26.0",53 "macOS" : "26.0"54 },55 "name" : "GlassMapPin",56 "platforms" : [57 "iOS",58 "iPadOS",59 "macOS"60 ],61 "schemaVersion" : 1,62 "sha256" : "f1805be9265fc65d493483854e13663458f2659af70be918179ffb9ee83a0263",63 "symbols" : [64 "GlassMapPinContent",65 "GlassMapPinFormatting",66 "GlassMapPinLayout",67 "GlassMapPinShape",68 "GlassMapPin"69 ],70 "version" : "1.1.0"71}72