Horizontal navigation

A simple navigation component, ideal for representing a section of a page that links to other pages or views within the page.

HorizontalNavigation

Cocoapods class reference view on Github

Default

Day Night

Usage


                                                
                                                @State var selectedTab: Int = 0
                                                BPKHorizontalNavigation(
                                                    tabs: [
                                                        .init(title: "Flights", icon: .flight, onClick: { selectedTab = 0 }),
                                                        .init(title: "Hotels", icon: .hotel, onClick: { selectedTab = 1 }),
                                                        .init(title: "Cars", icon: .car, onClick: { selectedTab = 2 }),
                                                    ],
                                                    selectedTab: selectedTab
                                                )

Setting the Size

BPkHorizontalNavigation supports both a default and a small size.


                                                
                                                @State var selectedTab: Int = 0
                                                BPKHorizontalNavigation(
                                                    tabs: [
                                                        .init(title: "Flights", icon: .flight, onClick: { selectedTab = 0 }),
                                                        .init(title: "Hotels", icon: .hotel, onClick: { selectedTab = 1 }),
                                                        .init(title: "Cars", icon: .car, onClick: { selectedTab = 2 }),
                                                    ],
                                                    size: .small,
                                                    selectedTab: selectedTab
                                                )

Tabs withou icons


                                                
                                                @State var selectedTab: Int = 0
                                                BPKHorizontalNavigation(
                                                    tabs: [
                                                        .init(title: "Flights", onClick: { selectedTab = 0 }),
                                                        .init(title: "Hotels", onClick: { selectedTab = 1 }),
                                                        .init(title: "Cars", onClick: { selectedTab = 2 }),
                                                    ],
                                                    selectedTab: selectedTab
                                                )