SP GlassKit1.1.0

GlassPopover

System popover with anchoring, compact adaptation and an accessible close action.

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

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

GlassPopover 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-popover

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-popover
ModuleSPGlassComponents
Kindnative-wrapper — the system .popover; the system draws the popover and its glass
PlatformsiOS 26, iPadOS 26, macOS 26
ExampleExamples/Gallery/Containers/GlassPopoverExample.swift

Minimal usage

Swift
GlassIconButton(systemImage: "info", accessibilityLabel: "Details") { showsInfo = true }
    .glassPopover(isPresented: $showsInfo) {
        Text("Prices include taxes.").padding()
    }

Variants

compactAdaptationIn a compact size class (iPhone, narrow iPad window)
.automatic (default)The system's choice: a sheet.
.popoverStays a popover with its arrow. For short content.
.sheetA sheet.
.fullScreenCoverA full-screen cover.

In a regular size class and on macOS the popover is always a popover.

Parameters

ParameterTypeDefaultMeaning
isPresentedBinding<Bool>—Presentation state.
titleLocalizedStringKey?nilHeading shown above the content.
attachmentAnchorPopoverAttachmentAnchor.rect(.bounds)Where the popover is attached on the source view.
arrowEdgeEdge?nilPreferred edge carrying the arrow; nil lets the system choose.
compactAdaptationGlassPopoverAdaptation.automaticSee Variants.
content@ViewBuilder—Content; it supplies its own padding.

States

Presented or not, owned by the host. When the popover is adapted to a sheet or a cover, a close button appears in a title row above the content (GlassPopoverAdaptation.needsCloseButton(isCompact:platform:)).

Advanced example

Swift
GlassButton("Sort", systemImage: "arrow.up.arrow.down") { showsSort = true }
    .glassPopover(isPresented: $showsSort, title: "Sort by", attachmentAnchor: .point(.bottom), arrowEdge: .top, compactAdaptation: .popover) {
        Picker("Sort by", selection: $order) {
            ForEach(SortOrder.allCases) { Text($0.title).tag($0) }
        }
        .pickerStyle(.inline)
        .labelsHidden()
        .padding()
    }

Accessibility

  • A real popover is dismissed by tapping outside, by Escape and by the VoiceOver escape gesture; all are the system's.
  • An adapted popover has no outside area: the added close button uses the system close role (symbol and localised label supplied by the system) and answers Escape on a hardware keyboard.
  • The title carries the header trait.

Limits

  • The close-button rule reads the size classes of the presented content. In a compact height with a regular width (some iPhones in landscape) the system may keep a popover while the rule shows the button; the button is then redundant but harmless.
  • The system may place the arrow on another edge than arrowEdge when there is no room.
  • GlassKit adds no surface; do not add glass inside the popover.
  • The adaptation was compiled for iOS and macOS; the rule deciding the close button is unit-tested, the presentation was not exercised in a running application by the automated tests.

Example

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

public struct GlassPopoverExample: GlassExample {
    public static let componentID = "glass-popover"
    @State private var showsDetails = false
    @State private var showsHelp = false

    public init() {}

    public var body: some View {
        HStack(spacing: 24) {
            GlassIconButton(systemImage: "info", accessibilityLabel: "Price details") { showsDetails = true }
                .glassPopover(isPresented: $showsDetails, title: "Price details", arrowEdge: .top, compactAdaptation: .popover) {
                    Text("Sample price, taxes included.")
                        .padding()
                        .frame(minWidth: 220, alignment: .leading)
                }
            GlassButton("Help", systemImage: "questionmark.circle") { showsHelp = true }
                .glassPopover(isPresented: $showsHelp, title: "Help", compactAdaptation: .sheet) {
                    Text("On a compact width this popover becomes a sheet with a close button.")
                        .padding()
                        .frame(maxWidth: .infinity, alignment: .leading)
                }
        }
        .padding()
    }
}

#Preview("GlassPopover") { GlassPopoverExample() }

Registry entry

Identifierglass-popover
Version1.1.0
Depends onglass-foundation
FrameworksSwiftUI
Public symbolsGlassPopoverAdaptation
LicenceMIT
Manifestmanifest.json

Files