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 "Initial release."12 ],13 "date" : "2026-12-02",14 "version" : "1.0.0"15 }16 ],17 "dependencies" : [18 {19 "id" : "glass-compass",20 "version" : "1.0.0"21 },22 {23 "id" : "glass-foundation",24 "version" : "1.0.0"25 },26 {27 "id" : "glass-icon-button",28 "version" : "1.0.0"29 },30 {31 "id" : "glass-maps-support",32 "version" : "1.0.0"33 }34 ],35 "description" : "Zoom and orientation actions in a glass container, independent of the map provider.",36 "examples" : [37 {38 "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",39 "title" : "GlassMapControls example"40 }41 ],42 "files" : [43 {44 "bytes" : 5658,45 "path" : "Maps/Maps/GlassMapControls.swift",46 "sha256" : "a5f2564cec77de48048021a67a22bc39145a62b482a28faae573d32d46076dd9"47 }48 ],49 "frameworks" : [5051 ],52 "id" : "glass-map-controls",53 "kind" : "custom-glass",54 "license" : "MIT",55 "minimumOS" : {56 "iOS" : "26.0",57 "iPadOS" : "26.0",58 "macOS" : "26.0"59 },60 "name" : "GlassMapControls",61 "platforms" : [62 "iOS",63 "iPadOS",64 "macOS"65 ],66 "schemaVersion" : 1,67 "sha256" : "8fb5410f2aa090cdcd26d7279fc005f68e17ec6d36f2c9e5bc220eb0d96bb746",68 "symbols" : [69 "GlassMapControls"70 ],71 "version" : "1.0.0"72}73