Repository Public MIT
1{2 "accessibility" : [3 "Tabs are system tabs: VoiceOver reads title, position, selection and badge; keyboard and pointer navigation follow the platform.",4 "Titles are required; a tab is never symbol-only for assistive technologies.",5 "Badge counts are formatted for the current locale.",6 "At accessibility text sizes the system shows the large content viewer for the tab bar."7 ],8 "category" : "navigation",9 "changelog" : [10 {11 "changes" : [12 "Initial release."13 ],14 "date" : "2026-12-02",15 "version" : "1.0.0"16 }17 ],18 "dependencies" : [19 {20 "id" : "glass-foundation",21 "version" : "1.0.0"22 },23 {24 "id" : "glass-navigation-support",25 "version" : "1.0.0"26 }27 ],28 "description" : "Typed wrapper around the system TabView with badges, dynamic tabs, per-tab navigation state and deep links.",29 "examples" : [30 {31 "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassTabBarExample: GlassExample {\n public static let componentID = \"glass-tab-bar\"\n\n enum DemoTab: String, Hashable, Sendable {\n case today, library, inbox, search\n }\n\n enum DemoRoute: Hashable, Sendable {\n case album(String)\n case track(String)\n }\n\n @State private var state = GlassTabNavigationState<DemoTab, DemoRoute>(selection: .today)\n @State private var unread = 3\n @State private var showsInbox = true\n\n /// Deep links of the demo: `glasskit-demo://library/<album>/<track>`.\n static let router = GlassTabRouter<DemoTab, DemoRoute>(\n schemes: [\"glasskit-demo\"],\n tabs: [\"today\": .today, \"library\": .library, \"inbox\": .inbox, \"search\": .search]\n ) { tab, components, _ in\n switch (tab, components.count) {\n case (_, 0): []\n case (.library, 1): [.album(components[0])]\n case (.library, 2): [.album(components[0]), .track(components[1])]\n default: nil\n }\n }\n\n public init() {}\n\n private var tabs: [GlassTabItem<DemoTab>] {\n var tabs = [\n GlassTabItem(id: DemoTab.today, title: \"Today\", systemImage: \"sun.max\"),\n GlassTabItem(id: DemoTab.library, title: \"Library\", systemImage: \"square.stack\"),\n ]\n if showsInbox {\n tabs.append(GlassTabItem(id: .inbox, title: \"Inbox\", systemImage: \"tray\", badge: .count(unread)))\n }\n tabs.append(GlassTabItem(id: .search, title: \"Search\", systemImage: \"magnifyingglass\", isSearch: true))\n return tabs\n }\n\n public var body: some View {\n GlassTabBar(tabs: tabs, state: $state, minimizeBehavior: .onScrollDown) { tab in\n root(tab)\n } destination: { route in\n switch route {\n case .album(let name):\n List(1...12, id: \\.self) { number in\n NavigationLink(\"Track \\(number)\", value: DemoRoute.track(\"\\(name) · \\(number)\"))\n }\n .navigationTitle(name)\n case .track(let name):\n Text(verbatim: name).font(.title2).navigationTitle(\"Now playing\")\n }\n }\n .onOpenURL { url in\n if let destination = Self.router.destination(for: url) { state.open(destination) }\n }\n .onChange(of: showsInbox) {\n state.reconcile(with: tabs.map(\\.id), fallback: .today)\n }\n }\n\n @ViewBuilder\n private func root(_ tab: DemoTab) -> some View {\n switch tab {\n case .today:\n List {\n Section(\"Deep links\") {\n Button(\"Open “Aurora” in Library\") {\n state.open(GlassTabDestination(tab: .library, path: [.album(\"Aurora\")]))\n }\n Button(\"Open track 4 of “Tides”\") {\n if let url = URL(string: \"glasskit-demo://library/Tides/4\"),\n let destination = Self.router.destination(for: url) {\n state.open(destination)\n }\n }\n }\n Section(\"Dynamic tabs\") {\n Toggle(\"Show the Inbox tab\", isOn: $showsInbox)\n Stepper(\"Unread: \\(unread)\", value: $unread, in: 0...99)\n }\n }\n .navigationTitle(\"Today\")\n case .library:\n List([\"Aurora\", \"Tides\", \"Quiet Hours\", \"Granite\"], id: \\.self) { album in\n NavigationLink(album, value: DemoRoute.album(album))\n }\n .navigationTitle(\"Library\")\n case .inbox:\n List(0..<unread, id: \\.self) { index in\n Text(\"Sample message \\(index + 1)\")\n }\n .overlay {\n if unread == 0 { ContentUnavailableView(\"No messages\", systemImage: \"tray\") }\n }\n .navigationTitle(\"Inbox\")\n case .search:\n Text(\"Search results appear here.\")\n .foregroundStyle(.secondary)\n .navigationTitle(\"Search\")\n }\n }\n}\n\n#Preview(\"GlassTabBar\") { GlassTabBarExample() }\n",32 "title" : "GlassTabBar example"33 }34 ],35 "files" : [36 {37 "bytes" : 7285,38 "path" : "Navigation/Navigation/GlassTabBar.swift",39 "sha256" : "c01ed0d697eb4915d4d586684b0c037f14c0a1bb6f0bd95d3cfa261f4de4c3d9"40 }41 ],42 "frameworks" : [4344 ],45 "id" : "glass-tab-bar",46 "kind" : "native-wrapper",47 "license" : "MIT",48 "minimumOS" : {49 "iOS" : "26.0",50 "iPadOS" : "26.0",51 "macOS" : "26.0"52 },53 "name" : "GlassTabBar",54 "platforms" : [55 "iOS",56 "iPadOS",57 "macOS"58 ],59 "schemaVersion" : 1,60 "sha256" : "a995a3fb27c2149286c37871e8456a8d7360d514d2ecbc6e061811d9feb4cf34",61 "symbols" : [62 "GlassTabBarMinimizeBehavior",63 "GlassTabBar",64 "GlassTabBadgeFormatter"65 ],66 "version" : "1.0.0"67}68