SPB Git

Repository Public MIT

manifest.json 6.0 KB 75 lines json

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        "Release 1.1.0: see the project changelog."13      ],14      "date" : "2026-12-03",15      "version" : "1.1.0"16    },17    {18      "changes" : [19        "Initial release."20      ],21      "date" : "2026-12-02",22      "version" : "1.0.0"23    }24  ],25  "dependencies" : [26    {27      "id" : "glass-foundation",28      "version" : "1.1.0"29    },30    {31      "id" : "glass-navigation-support",32      "version" : "1.1.0"33    }34  ],35  "description" : "Typed wrapper around the system TabView with badges, dynamic tabs, per-tab navigation state and deep links.",36  "examples" : [37    {38      "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",39      "title" : "GlassTabBar example"40    }41  ],42  "files" : [43    {44      "bytes" : 7285,45      "path" : "Navigation/Navigation/GlassTabBar.swift",46      "sha256" : "c01ed0d697eb4915d4d586684b0c037f14c0a1bb6f0bd95d3cfa261f4de4c3d9"47    }48  ],49  "frameworks" : [5051  ],52  "id" : "glass-tab-bar",53  "kind" : "native-wrapper",54  "license" : "MIT",55  "minimumOS" : {56    "iOS" : "26.0",57    "iPadOS" : "26.0",58    "macOS" : "26.0"59  },60  "name" : "GlassTabBar",61  "platforms" : [62    "iOS",63    "iPadOS",64    "macOS"65  ],66  "schemaVersion" : 1,67  "sha256" : "a995a3fb27c2149286c37871e8456a8d7360d514d2ecbc6e061811d9feb4cf34",68  "symbols" : [69    "GlassTabBarMinimizeBehavior",70    "GlassTabBar",71    "GlassTabBadgeFormatter"72  ],73  "version" : "1.1.0"74}75
Files main
Menu

Theme