Repository Public MIT
1import SwiftUI2import SPGlassKit34public struct GlassBreadcrumbExample: GlassExample {5 public static let componentID = "glass-breadcrumb"67 private static let fullPath: [GlassBreadcrumbItem<Int>] = [8 GlassBreadcrumbItem(id: 0, title: "Home", systemImage: "house"),9 GlassBreadcrumbItem(id: 1, title: "Projects"),10 GlassBreadcrumbItem(id: 2, title: "2026"),11 GlassBreadcrumbItem(id: 3, title: "Client workshop — été"),12 GlassBreadcrumbItem(id: 4, title: "Photos"),13 GlassBreadcrumbItem(id: 5, title: "Selected 📷"),14 ]1516 @State private var depth = 61718 public init() {}1920 private var path: [GlassBreadcrumbItem<Int>] { Array(Self.fullPath.prefix(depth)) }2122 public var body: some View {23 VStack(alignment: .leading, spacing: 24) {24 GlassBreadcrumb(path) { id in depth = id + 1 }25 GlassBreadcrumb(path, maxVisibleItems: 2) { id in depth = id + 1 }26 GlassBreadcrumb(Array(Self.fullPath.prefix(1))) { _ in }2728 Text("Current: \(path.last?.title ?? "—")")29 .font(.callout)30 .foregroundStyle(.secondary)31 Button("Go deeper") { depth = min(depth + 1, Self.fullPath.count) }32 .disabled(depth == Self.fullPath.count)33 }34 .frame(maxWidth: .infinity, alignment: .leading)35 .padding()36 }37}3839#Preview("GlassBreadcrumb") { GlassBreadcrumbExample().glassTheme(.emerald) }40