SP GlassKit1.1.0

GlassMapPanel

Extensible results panel that keeps the map behind it interactive.

  • System control
  • iOS 26 · iPadOS 26 · macOS 26
  • Version 1.1.0
  • glass-map-panel

Drawn by the system. GlassKit configures it and leaves the glass to the system.

GlassMapPanel running in SP Glass Studio.Capture
Capture of the component running in SP Glass Studio on the iOS 26.5 simulator. Liquid Glass is rendered by the system; this is an image, not a live preview.

Installation

spglass add glass-map-panel

Copies the sources and their dependencies into your project. Set up the CLI.

Swift
.package(url: "https://git.spboucher.ai/sp-glasskit.git", from: "1.1.0")

import SPGlassKit
Identifierglass-map-panel
ModuleSPGlassMaps
Kindnative-wrapper on compact widths (the system sheet); on regular widths and macOS the panel is a glassSurface floating over the map
PlatformsiOS 26, iPadOS 26, macOS 26
ExampleExamples/Gallery/Maps/GlassMapPanelExample.swift

Minimal usage

Swift
GlassMapPanel("Nearby", isPresented: $showsResults, detent: $detent) {
    MapView()
} content: {
    GlassMapResultList(results: results) { result in select(result) }
}

Variants

FormWhenWhat
SheetCompact 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 panelRegular width, and always on macOSA 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.
DockedOnly on request, with form: .dockedA glass panel at the bottom of the map's own bounds with a grabber: drag it, or activate it, to move between the three detents. For a map that takes only part of the screen, where a system sheet would cover content that is not the map.
DetentSheetSide panelDocked
.peek96 points: title onlyCollapsed to the title96 points: grabber and title
.halfSystem medium detentContent up to 360 points high55 % of the map's height
.fullSystem large detent (map not interactive)Full heightThe map's height less a margin

Parameters

ParameterTypeDefaultMeaning
titleLocalizedStringKey—Heading of the panel.
isPresentedBinding<Bool>—Whether the panel is shown.
detentBinding<GlassMapPanelDetent>—How far the panel is extended.
isDismissableBooltrueWhen false the sheet cannot be swiped away and the side panel has no close button.
formGlassMapPanelForm?nilForces .sheet, .side or .docked. nil picks the sheet on compact widths and the side panel elsewhere.
map@ViewBuilder—The map, any view.
content@ViewBuilder—Search field, results, details.

GlassMapResultList(results:selection:onSelect:) is a ready-made content: rows with a tinted icon tile, a title, a subtitle and an optional trailing detail (a distance, a travel time), a tint and a checkmark on the selected row, the selection callback, and "No results" when the list is empty. GlassMapResult is id, title, subtitle, systemImage, detail.

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 .isSelected trait 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.

Example

Complete example (compiled with the package)
import SwiftUI
import SPGlassKit

public struct GlassMapPanelExample: GlassExample {
    public static let componentID = "glass-map-panel"
    @State private var isPresented = false
    @State private var detent = GlassMapPanelDetent.half
    @State private var selection: String?
    @State private var query = ""
    @State private var engine = SampleMapEngine()

    /// Fictitious results.
    private let results = [
        GlassMapResult(id: "1", title: "Café Exemple", subtitle: "Sample data · café", systemImage: "cup.and.saucer.fill", detail: "120 m"),
        GlassMapResult(id: "2", title: "Bibliothèque fictive", subtitle: "Sample data · library", systemImage: "books.vertical.fill", detail: "350 m"),
        GlassMapResult(id: "3", title: "A place with a very long name that wraps over several lines in a narrow panel", subtitle: "Sample data · 1.2 km"),
        GlassMapResult(id: "4", title: "مقهى تجريبي", subtitle: "Sample data · 2 km", systemImage: "cup.and.saucer"),
        GlassMapResult(id: "5", title: "Parc d’essai", subtitle: "Sample data · 2.4 km", systemImage: "tree"),
    ]

    private var filteredResults: [GlassMapResult] {
        let trimmed = query.trimmingCharacters(in: .whitespaces)
        return trimmed.isEmpty ? results : results.filter { $0.title.localizedStandardContains(trimmed) }
    }

    public init() {}

    public var body: some View {
        GlassMapPanel("Nearby", isPresented: $isPresented, detent: $detent) {
            SampleMapBackdrop(heading: engine.heading ?? 0, zoom: engine.zoomScale)
                .overlay(alignment: .topTrailing) {
                    // The map and its controls stay usable while the panel is open.
                    GlassMapControls(engine: engine)
                        .padding()
                }
                .overlay(alignment: .bottomTrailing) {
                    GlassButton(isPresented ? "Hide results" : "Show results", systemImage: "list.bullet") {
                        isPresented.toggle()
                    }
                    .padding()
                }
        } content: {
            VStack(alignment: .leading, spacing: 12) {
                TextField("Search sample places", text: $query)
                    .textFieldStyle(.roundedBorder)
                GlassMapResultList(results: filteredResults, selection: selection) { result in
                    selection = result.id
                    detent = .peek
                }
            }
        }
    }
}

#Preview("GlassMapPanel") { GlassMapPanelExample().glassTheme(.ocean) }

Registry entry

Identifierglass-map-panel
Version1.1.0
Depends onglass-foundation
FrameworksSwiftUI
Public symbolsGlassMapPanelDetent, GlassMapPanelForm, GlassMapPanelLayout, GlassMapPanel, GlassMapResult, GlassMapResultList
LicenceMIT
Manifestmanifest.json

Files