{"id":22477727,"url":"https://github.com/swiftuiux/d3-menu-bar","last_synced_at":"2026-02-27T12:04:14.002Z","repository":{"id":63921127,"uuid":"493187558","full_name":"swiftuiux/d3-menu-bar","owner":"swiftuiux","description":"Customizable multi platform menu bar component with the dark and light scheme support - SwiftUI","archived":false,"fork":false,"pushed_at":"2024-11-27T11:13:43.000Z","size":8000,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-28T18:41:36.993Z","etag":null,"topics":["ios","macos","menu","menu-generator","menu-navigation","menubar","swift","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swiftuiux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-17T09:43:46.000Z","updated_at":"2024-11-27T14:05:58.000Z","dependencies_parsed_at":"2024-11-28T18:41:45.342Z","dependency_job_id":"5887999a-264f-40f3-81b6-f552ae574077","html_url":"https://github.com/swiftuiux/d3-menu-bar","commit_stats":{"total_commits":54,"total_committers":1,"mean_commits":54.0,"dds":0.0,"last_synced_commit":"a62979868e61ccd04ef235ef0dc88c804860fbe5"},"previous_names":["igor11191708/d3-menu-bar","the-igor/d3-menu-bar","igor111917180/d3-menu-bar","swiftuiux/d3-menu-bar"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftuiux%2Fd3-menu-bar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftuiux%2Fd3-menu-bar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftuiux%2Fd3-menu-bar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftuiux%2Fd3-menu-bar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swiftuiux","download_url":"https://codeload.github.com/swiftuiux/d3-menu-bar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228476038,"owners_count":17926134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","macos","menu","menu-generator","menu-navigation","menubar","swift","swiftui"],"created_at":"2024-12-06T14:12:03.969Z","updated_at":"2025-12-11T22:58:58.099Z","avatar_url":"https://github.com/swiftuiux.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Menu bar component SwiftUI\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fswiftuiux%2Fd3-menu-bar%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/swiftuiux/d3-menu-bar)\n\n## Features\n- [x] Observing menu selection changes via generic PreferenceKey\n- [x] The color intensity automatically adjusts depending on color scheme (Color+Ext.swift) You don't need to set color for every scheme\n- [x] Various strategies for the item menu width allocation\n- [x] Set scroll position according the initial selection\n- [x] Setting custom colors for the component\n- [x] Customize menu item style [round or square]\n- [x] iOS and macOS support\n- [x] Dark and light scheme support\n\n## Required\n\n### 1. enum\nDefine enum with menu items conforming to ```IMenuItem```\n\n```Swift \nenum MenuItems: String, IMenuItem {\n    case one = \"one\"\n    case two = \"two\"\n    case three = \"three\"\n}\n```\n### 2. create menu bar\n\n* `selected` - pass value bound to **@State var selected : MenuItems?**\n* `values` - Pass allCases as a parameter\n\n```Swift \nMenuBar(values: MenuItems.allCases, selected: $selected)\n  .onSelectionChanged{ item in }\n```\n\n## Optional\n\n* `strategy` - default strategy for the item menu width allocation is **auto**\n\n| Size strategy | Description |\n| --- | --- |\n|**fit**| Allocate all affordable space **not scrollable**|\n|**auto**| Auto size according the content |\n|**flex(CGFloat)**| Set up minimal width|\n\n* `color` - default value is **.black**\n\n* `style` - default style is **round**\n\n| Style | Description |\n| --- | --- |\n|**round**| rounded corners |\n|**square**| squared corners |\n\n\n### Component init examples\n\n```Swift\n    @State var selected : MenuItems?\n\n   VStack{\n        MenuBar(values: items, selected: $selected, strategy: .flex(102), color: .green)\n        MenuBar(values: items, selected: $selected, color: .purple, style: .square)\n        MenuBar(values: items, selected: $selected, strategy: .fit, color: .blue)        \n        MenuBar(values: items, selected: $selected, color: .red)\n    } \n```\n[![click to watch expected UI behavior for the example](https://github.com/swiftuiux/d3-menu-bar/blob/main/Sources/img/img.png)](https://youtu.be/PQRkU7yWUrk)\n\n## Code example\n\nTake a look on the example preview in [**MenuContentView.swift**](https://github.com/swiftuiux/d3-menu-bar/blob/main/Sources/d3-menu-bar/example/MenuViewExample.swift) or create a project, add the package and put **MenuContentView()** in **ContentView()**\n\n## Used in\n[Auto scrollable header menu - SwiftUI \u0026 Combine](https://github.com/swiftuiux/food-scrollable-menu-list)\n\n## Documentation(API)\n- You need to have Xcode 13 installed in order to have access to Documentation Compiler (DocC)\n- Go to Product \u003e Build Documentation or **⌃⇧⌘ D**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftuiux%2Fd3-menu-bar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiftuiux%2Fd3-menu-bar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftuiux%2Fd3-menu-bar/lists"}