Overview
Leight-weight, reusable and heighly customizable tab bar.
Usage
// Step 1: Create Data for tab bar
let tabItems = [TabBarItemViewModel(id: UUID().description, title: "Tab 1", image: UIImage(systemName: "trash"), state: .selected),
TabBarItemViewModel(id: UUID().description, title: "Tab 2", image: nil)]
// Step 2: Create tab bar
let tabView = TabBarView(data: TabBarViewModel(items: tabItems)) { [weak self] (selectedItem) in // always use weak to avoid reference cycle
// on item selected
print(selectedItem)
}
// Step 3: Customize (optional)
tabView
// apply style on tabView (tab items are placed inside this view)
.style(RectStyle())
// apply styles on tab item
.itemUnselectedStyle(RectStyle())
.itemSelectedStyle(CapsuleBorderStyle())
Installation Guide
Carthage
Step 1: Add following to your CartFile
github "LenisDev/TabBar" ~> 0.0.1
Step 2:
run carthage update
from current project directory.
That's all, you have it installed.
CocoaPods
Step 1:
Add pod 'Tab', '~> 0.0.1'
to your Podfile:
target 'MyApp' do
pod 'Tab', '~> 0.0.1'
end
Step 2:
run pod install
from current project directory.
That's all, you have it installed.
Try it using following command
pod try Tab
Swift Package Manager
dependencies: [
.package(url: "https://github.com/LenisDev/TabBar.git", .upToNextMajor(from: "0.0.1"))
]
Contribute
- Play around and report bugs
- Fix issues and create PR
- Add documentations and new features