Swiftpack.co -  QuynhNguyen/SlidingTabView as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
QuynhNguyen/SlidingTabView
SwiftUI - Sliding Tab View
.package(url: "https://github.com/QuynhNguyen/SlidingTabView.git", from: "1.0.2")

SlidingTabView is a simple Android-Like tab view that is built using the latest and greatest SwiftUI. Almost everything is customizable!

Installation

Please use Swift Package Manager to install SlidingTabView

Usage

Just instantiate and bind it to your state. That is it!

@State private var selectedTabIndex = 0
SlidingTabView(selection: $selectedTabIndex,tabs: ["First Tab", "Second Tab"]

Canvas Preview

struct SlidingTabConsumerView : View {
    @State private var selectedTabIndex = 0

    var body: some View {
        VStack(alignment: .leading) {
            SlidingTabView(selection: self.$selectedTabIndex, tabs: ["First", "Second"])
            (selectedTabIndex == 0 ? Text("First View") : Text("Second View")).padding()
            Spacer()
        }
            .padding(.top, 50)
            .animation(.none)
    }
}

@available(iOS 13.0.0, *)
struct SlidingTabView_Previews : PreviewProvider {
    static var previews: some View {
        SlidingTabConsumerView()
    }
}

Suggestions or feedback?

Feel free to create a pull request!

GitHub

link
Stars: 99
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

swiftui beta 5 compatibility fixes
2 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics