TabStriper

TabStriper 是一个通过选择标签或滑动屏幕来切换屏幕的库,使用 SwiftUI 构建。

Platforms License: MIT

用法

struct ColorView: View {
    let color: Color
    var body: some View {
        self.color
    }
}

struct ContentView: View {
    
    let colorViews: [StripView] = [
        StripView(id: 1, title: "green", view: AnyView(ColorView(color: .green))),
        StripView(id: 2, title: "blue", view: AnyView(ColorView(color: .blue)))
    ]
    
    var body: some View {
        TabStriper(stripViews: self.colorViews)
            .barColor(.red)
            .titleColor(.gray)
            .selectedTitleColor(.black)
    }
}

安装

可以通过 Swift Package Manager 获取 TabStriper

使用 Xcode 11,前往 File -> Swift Packages -> Add Package Dependency 并输入 https://github.com/giiiita/TabStriper.git