Skip to content

Reusable SwiftUI Tab Bar with an animated capsule for pagination

License

Notifications You must be signed in to change notification settings

cjlarsen/CLAnimatedTabView

Repository files navigation

CLAnimatedTabView

Reusable SwiftUI View with a top tab bar and animated capsule.
Allows the ability to pass in views of the same type displayed as pages, selectable with top tab bar.

How to add to a project

Able to be added using Swift Package Manager

Example

Simulator.Screen.Recording.-.iPhone.15.-.2024-05-05.at.15.59.36.mp4

Example Implementation

import SwiftUI
import CLAnimatedTabView

struct ContentView: View {
    var body: some View {
        let viewModel = CLAnimatedTabViewModel(tabBarHeight: 69.0, tabNames: ["Tab 1", "Tab 2", "Tab 3"])
        CLAnimatedTabView(viewModel: viewModel) {
            Text("1")
            Text("2")
            Text("3")
        }
    }
}

About

Reusable SwiftUI Tab Bar with an animated capsule for pagination

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages