标签 0.0.2

Tab 0.0.2

Manish Pandey 维护。



Tab 0.0.2

  • By
  • Manish Pandey

Minimal, yet higly customizable

License Release version


概述

轻量级、可重用且高度可定制的标签栏。


用法

  
  // 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())
  

安装指南

Carthage

步骤 1:将以下内容添加到CartFile中

github "LenisDev/TabBar" ~> 0.0.1

步骤 2:从当前项目目录运行carthage update

就这样,您已经安装完成了。


CocoaPods

步骤 1:将pod 'Tab', '~> 0.0.1'添加到Podfile

target 'MyApp' do
  pod 'Tab', '~> 0.0.1'
end

步骤 2:从当前项目目录运行pod install

就这样,您已经安装完成了。


使用以下命令尝试使用

pod try Tab

Swift 软件包管理器

dependencies: [
    .package(url: "https://github.com/LenisDev/TabBar.git", .upToNextMajor(from: "0.0.1"))
]

贡献

  • 试一试并报告 Bug
  • 修复问题并创建 PR
  • 添加文档和新增功能