SP GlassKit1.1.0

GlassNavigationBar

NavigationStack with a title, toolbar actions and the system back button.

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

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

GlassNavigationBar 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-navigation-bar

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-navigation-bar
ModuleSPGlassNavigation
Kindnative-wrapper — a NavigationStack configured with .navigationTitle and .toolbar
PlatformsiOS 26, iPadOS 26, macOS 26
ExampleExamples/Gallery/Navigation/GlassNavigationBarExample.swift

Minimal usage

Swift
GlassNavigationBar("Inbox") {
    MessageList()
}

Variants

VariantUse
titleDisplay: .largeLarge title that collapses on scroll (iOS).
titleDisplay: .inlineCompact title, for detail pages.
subtitle:Secondary line under the title (navigationSubtitle).
leading: / trailing:Actions described by GlassToolbarAction values.
.glassNavigationBar(...) modifierConfigures the bar of a page pushed on an existing stack.

Parameters

ParameterTypeDefaultMeaning
titleLocalizedStringKey—Title of the page.
subtitleLocalizedStringKey?nilSubtitle.
titleDisplayGlassNavigationTitleDisplay.automatic.automatic, .inline or .large.
pathBinding<NavigationPath>?nilNavigation path when the host drives navigation.
leading[GlassToolbarAction][]Actions at the leading edge. One is shown; others go to a menu.
trailing[GlassToolbarAction][]Actions at the trailing edge.
content@ViewBuilder—Root page of the stack.

GlassNavigationBarConfiguration carries the same values when the title is a Text built elsewhere.

States

The back button, its title and the swipe-back gesture are the system's. A disabled action is isEnabled: false. Trailing actions that do not fit move to a "More actions" menu: two stay on a compact width, four on a regular one, one at accessibility text sizes (GlassNavigationBarLayout.trailingCapacity).

Advanced example

Swift
@State private var path = NavigationPath()

GlassNavigationBar("Projects", titleDisplay: .large, path: $path, trailing: [
    GlassToolbarAction(id: "new", title: "New project", systemImage: "plus",
                       shortcut: KeyboardShortcut("n"), priority: .high) { create() },
    GlassToolbarAction(id: "filter", title: "Filter", systemImage: "line.3.horizontal.decrease") { showFilter() },
]) {
    ProjectList()
        .navigationDestination(for: Project.ID.self) { id in
            ProjectView(id: id)
                .glassNavigationBar("Project", titleDisplay: .inline, trailing: [
                    GlassToolbarAction(id: "delete", title: "Delete", systemImage: "trash", role: .destructive) { delete(id) },
                ])
        }
}

Accessibility

  • Every action has a title: it is the VoiceOver label, the tooltip on macOS and the menu title when the action overflows.
  • With an accessibility text size on a compact width, a large title is shown inline so that it does not fill the screen, and only one trailing action stays in the bar.
  • Bar buttons get the system's large content viewer at accessibility sizes.
  • Keyboard shortcuts of the actions work whether the action is in the bar or in the menu.

Limits

  • The bar, its glass and the back button cannot be restyled; the theme only supplies the tint.
  • titleDisplay has no effect on macOS, which shows the title in the window toolbar.
  • Do not nest a GlassNavigationBar inside another navigation stack; use the modifier on pushed pages.
  • Behaviour at accessibility sizes was verified through the layout functions and compilation, not on a running device.

Example

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

public struct GlassNavigationBarExample: GlassExample {
    public static let componentID = "glass-navigation-bar"
    @State private var notes = ["Quarterly review", "Trip to Lisbon", "A much longer note title that has to wrap or truncate gracefully"]
    @State private var isFlagged = false

    public init() {}

    public var body: some View {
        GlassNavigationBar(
            "Notes",
            subtitle: "\(notes.count) notes",
            titleDisplay: .large,
            leading: [
                GlassToolbarAction(id: "sort", title: "Sort", systemImage: "arrow.up.arrow.down") { notes.sort() },
            ],
            trailing: [
                GlassToolbarAction(id: "new", title: "New note", systemImage: "square.and.pencil", shortcut: KeyboardShortcut("n"), priority: .high) {
                    notes.append("Untitled \(notes.count + 1)")
                },
                GlassToolbarAction(id: "shuffle", title: "Shuffle", systemImage: "shuffle") { notes.shuffle() },
                GlassToolbarAction(id: "clear", title: "Delete all", systemImage: "trash", role: .destructive, isEnabled: !notes.isEmpty, priority: .low) {
                    notes.removeAll()
                },
            ]
        ) {
            List(notes, id: \.self) { note in
                NavigationLink(note, value: note)
            }
            .overlay {
                if notes.isEmpty { ContentUnavailableView("No notes", systemImage: "note.text") }
            }
            .navigationDestination(for: String.self) { note in
                ScrollView {
                    Text(verbatim: note)
                        .font(.title3)
                        .frame(maxWidth: .infinity, alignment: .leading)
                        .padding()
                }
                .glassNavigationBar(
                    "Note",
                    titleDisplay: .inline,
                    trailing: [
                        GlassToolbarAction(id: "flag", title: isFlagged ? "Remove flag" : "Flag", systemImage: isFlagged ? "flag.fill" : "flag") {
                            isFlagged.toggle()
                        },
                    ]
                )
            }
        }
    }
}

#Preview("GlassNavigationBar") { GlassNavigationBarExample().glassTheme(.ocean) }

Registry entry

Identifierglass-navigation-bar
Version1.1.0
Depends onglass-foundation, glass-toolbar
FrameworksSwiftUI
Public symbolsGlassNavigationTitleDisplay, GlassNavigationBarConfiguration, GlassNavigationBar, GlassNavigationBarLayout
LicenceMIT
Manifestmanifest.json

Files