Contents

darrarski/swiftui-tabs-view

SwiftUI tabbed interface. Customizable replacement for `SwiftUI.TabView`.

▶️ Usage

Add as a dependecy to your project using Swift Package Manager.

Embed in your SwiftUI view:

import SwiftUITabsView

struct ContentView: View {
  var body: some View {
    TabsView(
      tabs: /* [Tab]  */,
      selectedTab: /* Binding<Tab> */,
      barPosition: /* ToolbarPosition */,
      ignoresKeyboard: /* Bool */,
      frameChangeAnimation: /* Animation? */,
      tabsBar: /* @ViewBuilder @escaping ([Tab], Binding<Tab>) -> TabsBar */,
      content: /* @ViewBuilder @escaping (Tab) -> TabContent */
    )
  }
}

Check out documentation comments and the included example app.

If your tab's content view is embedded in NavigationView, use tabsBarSafeAreaInset modifier to apply safe area insets that matches the tabs bar:

TabsView(
  /* ... */
  content: { tab in 
    NavigationView {
      ContentView(for: tab)
        .tabsBarSafeAreaInset()
    }
  }
)

🛠 Development

Open SwiftUITabsView.xcworkspace in Xcode (≥13.1) for development.

Use ExampleApp-iOS scheme to build and run the iOS example application.

Use ExampleApp-macOS scheme to build and run the macOS example application.

☕️ Do you like the project?

<a href="https://www.buymeacoffee.com/darrarski" target="_blank"> <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" align="right" height="60"/> </a>

Consider supporting further development and buy me a coffee.

&nbsp;

📄 License

Copyright © 2022 Dariusz Rybicki Darrarski

License: MIT

Package Metadata

Repository: darrarski/swiftui-tabs-view

Stars: 13

Forks: 1

Open issues: 1

Default branch: main

Primary language: swift

License: MIT

Topics: ios, swift-package, swiftui, tabbar, tabs, tabview

README: README.md