GlassMapPanel
| Identifier | glass-map-panel |
| Module | SPGlassMaps |
| Kind | native-wrapper on compact widths (the system sheet); on regular widths and macOS the panel is a glassSurface floating over the map |
| Platforms | iOS 26, iPadOS 26, macOS 26 |
| Example | Examples/Gallery/Maps/GlassMapPanelExample.swift |
Minimal usage
swift
GlassMapPanel("Nearby", isPresented: $showsResults, detent: $detent) {
MapView()
} content: {
GlassMapResultList(results: results) { result in select(result) }
}Variants
| Form | When | What |
|---|---|---|
| Sheet | Compact width on iOS and iPadOS (iPhone, narrow iPad windows) | .sheet with three detents and presentationBackgroundInteraction(.enabled(upThrough: .medium)): the map stays interactive at peek and half. |
| Side panel | Regular width, and always on macOS | A glass panel over the leading edge of the map, about a third of the width (280…380 points), with collapse and close buttons. The rest of the map stays interactive. |
| Detent | Sheet | Side panel |
|---|---|---|
.peek |
96 points: title only | Collapsed to the title |
.half |
System medium detent | Content up to 360 points high |
.full |
System large detent (map not interactive) | Full height |
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
title |
LocalizedStringKey |
— | Heading of the panel. |
isPresented |
Binding<Bool> |
— | Whether the panel is shown. |
detent |
Binding<GlassMapPanelDetent> |
— | How far the panel is extended. |
isDismissable |
Bool |
true |
When false the sheet cannot be swiped away and the side panel has no close button. |
map |
@ViewBuilder |
— | The map, any view. |
content |
@ViewBuilder |
— | Search field, results, details. |
GlassMapResultList(results:selection:onSelect:) is a ready-made content: rows with a symbol, a title and a subtitle, a checkmark on the selected row, the selection callback, and "No results" when the list is empty. GlassMapResult is id, title, subtitle, systemImage.
States
Hidden, peek, half, full. In the result list: normal, selected, empty.
Advanced example
swift
GlassMapPanel("Listings", isPresented: .constant(true), detent: $detent, isDismissable: false) {
Map(position: $engine.position, selection: $selection) { /* annotations */ }
.overlay(alignment: .topTrailing) { GlassMapControls(engine: engine).padding() }
} content: {
VStack(alignment: .leading) {
TextField("Search this area", text: $query)
.textFieldStyle(.roundedBorder)
GlassMapResultList(results: model.results(matching: query), selection: selection) { result in
selection = result.id
detent = .peek // free the map to show the selected place
}
}
}Accessibility
- The title has the header trait. The side panel's buttons are labelled "Collapse" / "Expand" and "Close".
- Result rows are buttons combining title and subtitle; the selected row has the
.isSelectedtrait and a checkmark. - The sheet keeps the system's behaviour (drag indicator, VoiceOver detent actions, keyboard avoidance).
- With Reduce Transparency the side panel becomes an opaque themed surface.
Limits
- The form is chosen from the horizontal size class and the platform (
GlassMapPanelLayout.form); it changes when an iPad window becomes compact. - A sheet is modal for assistive technologies even when the map behind it accepts touches.
- In the sheet form, while the map is interactive (
peek,half), a tap on the map does not dismiss the sheet. - The side panel is not resizable by dragging; it has three sizes.
- Dense content inside the side panel sits on glass: keep it to a list of results or short details, as the system does in Maps.
- The interaction between a live map and the sheet was compiled but not exercised in a running application during verification; the form, detent and width decisions are unit-tested.