Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Examples/Gallery/Navigation/GlassBreadcrumbExample.swift8// Module : Examples9// Repository : https://git.spboucher.ai/sp-glasskit10// Project Website : https://glass.spboucher.ai11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import SwiftUI42import SPGlassKit4344public struct GlassBreadcrumbExample: GlassExample {45 public static let componentID = "glass-breadcrumb"4647 private static let fullPath: [GlassBreadcrumbItem<Int>] = [48 GlassBreadcrumbItem(id: 0, title: "Home", systemImage: "house"),49 GlassBreadcrumbItem(id: 1, title: "Projects"),50 GlassBreadcrumbItem(id: 2, title: "2026"),51 GlassBreadcrumbItem(id: 3, title: "Client workshop — été"),52 GlassBreadcrumbItem(id: 4, title: "Photos"),53 GlassBreadcrumbItem(id: 5, title: "Selected 📷"),54 ]5556 @State private var depth = 65758 public init() {}5960 private var path: [GlassBreadcrumbItem<Int>] { Array(Self.fullPath.prefix(depth)) }6162 public var body: some View {63 VStack(alignment: .leading, spacing: 24) {64 GlassBreadcrumb(path) { id in depth = id + 1 }65 GlassBreadcrumb(path, maxVisibleItems: 2) { id in depth = id + 1 }66 GlassBreadcrumb(Array(Self.fullPath.prefix(1))) { _ in }6768 Text("Current: \(path.last?.title ?? "—")")69 .font(.callout)70 .foregroundStyle(.secondary)71 Button("Go deeper") { depth = min(depth + 1, Self.fullPath.count) }72 .disabled(depth == Self.fullPath.count)73 }74 .frame(maxWidth: .infinity, alignment: .leading)75 .padding()76 }77}7879#Preview("GlassBreadcrumb") { GlassBreadcrumbExample().glassTheme(.emerald) }80