Repository Public MIT
1{2 "accessibility" : [3 "The cluster is a container labelled \"Map controls\"; each button keeps its own label (\"Zoom in\", \"Zoom out\") and tooltip.",4 "Hit targets are at least 44 points on iOS and iPadOS.",5 "With Reduce Transparency the group is a plain container and the buttons use the system's own opaque treatment."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-compass",27 "version" : "1.1.0"28 },29 {30 "id" : "glass-foundation",31 "version" : "1.1.0"32 },33 {34 "id" : "glass-icon-button",35 "version" : "1.1.0"36 },37 {38 "id" : "glass-maps-support",39 "version" : "1.1.0"40 }41 ],42 "description" : "Zoom and orientation actions in a glass container, independent of the map provider.",43 "examples" : [44 {45 "code" : "import SwiftUI\nimport SPGlassKit\n#if canImport(MapKit)\nimport MapKit\n#endif\n\npublic struct GlassMapControlsExample: GlassExample {\n public static let componentID = \"glass-map-controls\"\n @State private var engine = SampleMapEngine()\n #if canImport(MapKit)\n @State private var usesMapKit = false\n @State private var mapKitEngine = GlassMapKitEngine(\n position: .camera(MapCamera(centerCoordinate: CLLocationCoordinate2D(latitude: 45.4215, longitude: -75.6972), distance: 6_000, heading: 30))\n )\n #endif\n\n public init() {}\n\n public var body: some View {\n VStack(spacing: 12) {\n #if canImport(MapKit)\n Toggle(\"Use the MapKit adapter (loads map tiles)\", isOn: $usesMapKit)\n .padding(.horizontal)\n if usesMapKit {\n mapKitMap\n } else {\n placeholderMap\n }\n #else\n placeholderMap\n #endif\n }\n }\n\n /// A provider-independent engine: the controls only see `GlassMapEngine`.\n private var placeholderMap: some View {\n SampleMapBackdrop(heading: engine.heading ?? 0, zoom: engine.zoomScale)\n .overlay(alignment: .topTrailing) {\n GlassMapControls(engine: engine) {\n GlassCompass(heading: engine.heading) { engine.resetNorth() }\n GlassIconButton(systemImage: \"rotate.right\", accessibilityLabel: \"Rotate the sample map\") {\n engine.rotate(by: 45)\n }\n }\n .padding()\n }\n .overlay(alignment: .bottom) {\n GlassMapControls(canZoomIn: engine.canZoomIn, canZoomOut: engine.canZoomOut, axis: .horizontal, size: .small) {\n engine.zoomIn()\n } onZoomOut: {\n engine.zoomOut()\n }\n .padding(.bottom, 40)\n }\n }\n\n #if canImport(MapKit)\n private var mapKitMap: some View {\n Map(position: $mapKitEngine.position)\n .onMapCameraChange(frequency: .continuous) { context in\n mapKitEngine.cameraChanged(context.camera)\n }\n .overlay(alignment: .topTrailing) {\n GlassMapControls(engine: mapKitEngine)\n .padding()\n }\n }\n #endif\n}\n\n#Preview(\"GlassMapControls\") { GlassMapControlsExample().glassTheme(.ocean) }\n",46 "title" : "GlassMapControls example"47 }48 ],49 "files" : [50 {51 "bytes" : 7298,52 "path" : "Maps/Maps/GlassMapControls.swift",53 "sha256" : "10270a0439f722fa3b950da2559c88c0d9b30135e17aa69e53cbcae0a0a5ebda"54 }55 ],56 "frameworks" : [5758 ],59 "id" : "glass-map-controls",60 "kind" : "custom-glass",61 "license" : "MIT",62 "minimumOS" : {63 "iOS" : "26.0",64 "iPadOS" : "26.0",65 "macOS" : "26.0"66 },67 "name" : "GlassMapControls",68 "platforms" : [69 "iOS",70 "iPadOS",71 "macOS"72 ],73 "schemaVersion" : 1,74 "sha256" : "065c51dcf01baf889525d850dc18a69a52dd9f3a1f3e818776270003abf4cc56",75 "symbols" : [76 "GlassMapControls"77 ],78 "version" : "1.1.0"79}80