{"id":25899394,"url":"https://github.com/zijievv/swiftui-tab-bar","last_synced_at":"2025-03-03T01:28:30.327Z","repository":{"id":166805250,"uuid":"642280895","full_name":"zijievv/swiftui-tab-bar","owner":"zijievv","description":"A highly customizable tab bar view made in SwiftUI","archived":false,"fork":false,"pushed_at":"2024-06-01T14:30:43.000Z","size":1178,"stargazers_count":67,"open_issues_count":3,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-06-01T16:34:37.411Z","etag":null,"topics":["customview","ios","swift","swiftui","tab-bar","tabbar"],"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/zijievv.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":"2023-05-18T08:08:14.000Z","updated_at":"2024-06-01T14:30:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"58a057c7-af1a-4dea-87cf-00655ffeb98e","html_url":"https://github.com/zijievv/swiftui-tab-bar","commit_stats":null,"previous_names":["zijievv/tabbar","zijievv/swiftui-tab-bar"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijievv%2Fswiftui-tab-bar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijievv%2Fswiftui-tab-bar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijievv%2Fswiftui-tab-bar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijievv%2Fswiftui-tab-bar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zijievv","download_url":"https://codeload.github.com/zijievv/swiftui-tab-bar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241594303,"owners_count":19987775,"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":["customview","ios","swift","swiftui","tab-bar","tabbar"],"created_at":"2025-03-03T01:28:29.809Z","updated_at":"2025-03-03T01:28:30.320Z","avatar_url":"https://github.com/zijievv.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n- [Usage](#usage)\n  - [Shape and Fill Style](#shape-and-fill-style)\n  - [Visibility with Animation and Transition](#visibility-with-animation-and-transition)\n- [Installation](#installation)\n  - [Swift Package Manager (SPM)](#swift-package-manager-(spm))\n  - [Xcode](#xcode)\n\n# TabBar\n\n\u003cp align=\"left\"\u003e\n\u003ca href=\"https://www.swift.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/Language-Swift%205.5-%23DE5D43\"\u003e\u003c/a\u003e\n\u003ca href=\"https://developer.apple.com/ios/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Platform-iOS%2015.0%2B-%2359ABE1\"\u003e\u003c/a\u003e\n\u003ca href=\"https://developer.apple.com/documentation/SwiftUI\"\u003e\u003cimg src=\"https://img.shields.io/badge/Framework-SwiftUI-%233B82F7\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.swift.org/package-manager/\"\u003e\u003cimg src=\"https://img.shields.io/badge/SPM-Compatible-%2368CE67\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.apache.org/licenses/LICENSE-2.0.txt\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-%238E8E93\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n**`TabBar`** is a highly customizable tab bar view made in SwiftUI that functions similarly to [`TabView`](https://developer.apple.com/documentation/swiftui/tabview).\n\n## Usage\n\nSimilar to `TabView`, the `TabBar` accepts a Binding value that conforms to `Hashable`.\n\n```swift\nimport SwiftUI\nimport TabBarModule\n\nstruct ContentView: View {\n    @State private var item: Int = 0\n\n    var body: some View {\n        TabBar(selection: $item) {\n            HomeView()\n                .tabItem(0) {\n                    Image(systemName: item == 0 ? \"house.fill\" : \"house\")\n                        .font(.title3)\n                    Text(\"Home\")\n                        .font(.system(.footnote, design: .rounded).weight(item == 0 ? .bold : .medium))\n                }\n            MarksView()\n                .tabItem(1) { /* ... */ }\n            UserView()\n                .tabItem(2) { /* ... */ }\n        }\n    }\n}\n```\n\nThe `TabBar` provides a default style when no other modifiers are set.\n\n\u003cimg src=\"Resources/Images/default-half.png\" alt=\"default-half\" style=\"zoom:50%;\" /\u003e\n\nWith modifiers, it is easy to set the `TabBar`'s styles.\n\n```swift\nTabBar(selection: $item) {\n    // ...\n}\n.tabBarFill(.regularMaterial)\n.tabBarMargins(.vertical, 8)\n.tabBarPadding(.vertical, 8)\n.tabBarPadding(.horizontal, 16)\n.tabBarShape(RoundedRectangle(cornerRadius: 16, style: .continuous))\n.tabBarShadow(radius: 1, y: 1)\n```\n\n\u003cimg src=\"Resources/Images/RoundedRectShadow-half.png\" alt=\"RoundedRectShadow-half\" style=\"zoom:50%;\" /\u003e\n\n### Shape and Fill Style\n\nThe `TabBar`  accepts any background shape that conforms to the `Shape` protocol (e.g., `Capsule`).\n\n```swift\nTabBar(selection: $item) { /* ... */ }\n    .tabBarPadding(.vertical, 8)\n    .tabBarPadding(.horizontal, 16)\n    .tabBarShape(Capsule(style: .continuous))\n    .tabBarFill(.linearGradient(\n        colors: [.yellow, .yellow.opacity(0.4)], \n        startPoint: .top, endPoint: .bottom))\n```\n\n\u003cimg src=\"Resources/Images/CapsuleGradient-half.png\" alt=\"CapsuleGradient-half\" style=\"zoom:50%;\" /\u003e\n\nThe `TabBar` accepts any fill that conforms to the `ShapeStyle` protocol.\n\n```swift\nTabBar(selection: $item) { /* ... */ }\n    .tabBarFill(.linearGradient(\n        colors: [.orange, .yellow], startPoint: .top, endPoint: .bottom))\n```\n\n\u003cimg src=\"Resources/Images/defaultShapeGradient-half.png\" alt=\"defaultShapeGradient-half\" style=\"zoom:50%;\" /\u003e\n\nIn addition to using `ShapeStyle` for filling, you can also use any view to set the foreground of the `TabBar`.\n\n```swift\nTabBar(selection: $item) { /* ... */ }\n    .tabBarForeground {\n        Image(\"BarOrange\").resizable().scaledToFill()\n    }\n    .tabBarShape(RoundedRectangle(cornerRadius: 16, style: .continuous))\n    .tabBarShadow(radius: 1, y: 2)\n```\n\n\u003cimg src=\"Resources/Images/ForegroundView-half.png\" alt=\"ForegroundView-half\" style=\"zoom:50%;\" /\u003e\n\n### Visibility with Animation and Transition\n\nThe `TabBar` accepts a Binding value of type `Visibility` to control its visibility. When visibility is set to `.automatic`, the `TabBar` will observe the keyboard's appearance to automatically show or hide itself.\n\nYou can customize the animation and transition for the appearance and disappearance of the `TabBar`.\n\n```swift\nTabBar(selection: $item, visibility: $visibility) { /* ... */ }\n    .tabBarTransition(.move(edge: .bottom).combined(with: .opacity))\n    .tabBarAnimation { isTabBarVisible in\n        isTabBarVisible ? .easeInOut : .linear\n    }\n```\n\n## Installation\n\nRequirement: iOS 15.0+\n\n### [Swift Package Manager](https://www.swift.org/package-manager/) (SPM)\n\nAdd the following line to the dependencies in `Package.swift`, to use the `TabBarModule` in a SPM project:\n\n```swift\n.package(url: \"https://github.com/zijievv/swiftui-tab-bar\", from: \"0.0.1\"),\n```\n\n In your target:\n\n```swift\n.target(name: \"\u003cTARGET_NAME\u003e\", dependencies: [\n    .product(name: \"TabBarModule\", package: \"swiftui-tab-bar\"),\n    // ...\n]),\n```\n\nAdd `import TabBarModule` into your source code to use `TabBar`.\n\n### Xcode\n\nGo to `File \u003e Add Package Dependencies...` and paste the repo's URL:\n\n```\nhttps://github.com/zijievv/swiftui-tab-bar.git\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzijievv%2Fswiftui-tab-bar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzijievv%2Fswiftui-tab-bar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzijievv%2Fswiftui-tab-bar/lists"}