Giter Site home page Giter Site logo

swiftui-tabs-view's Introduction

SwiftUI Tabs View

Swift 5.5 platform iOS 15 | macOS 12.1

SwiftUI tabbed interface. Customizable replacement for SwiftUI.TabView.

iOS macOS
Example iOS app light modeExample iOS app dark mode Example macOS app light modeExample macOS app dark mode
  • Build with vanilla SwiftUI (no external dependencies).
  • Replaces SwiftUI.TabView.
  • Allows wide customization.
  • Supports light and dark mode.
  • Tabbar hides below the keyboard, like with vanilla 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?

Buy Me A Coffee

Consider supporting further development and buy me a coffee.

 

📄 License

Copyright © 2022 Dariusz Rybicki Darrarski

License: MIT

swiftui-tabs-view's People

Contributors

darrarski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

azuredark

swiftui-tabs-view's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.