https://github.com/darrarski/swiftui-tabs-view
SwiftUI tabbed interface. Customizable replacement for `SwiftUI.TabView`.
https://github.com/darrarski/swiftui-tabs-view
ios swift-package swiftui tabbar tabs tabview
Last synced: 7 months ago
JSON representation
SwiftUI tabbed interface. Customizable replacement for `SwiftUI.TabView`.
- Host: GitHub
- URL: https://github.com/darrarski/swiftui-tabs-view
- Owner: darrarski
- License: mit
- Created: 2022-01-14T16:38:06.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-25T12:17:20.000Z (over 3 years ago)
- Last Synced: 2024-05-02T05:10:40.094Z (about 1 year ago)
- Topics: ios, swift-package, swiftui, tabbar, tabs, tabview
- Language: Swift
- Homepage:
- Size: 1.98 MB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftUI Tabs View

SwiftUI tabbed interface. Customizable replacement for `SwiftUI.TabView`.
|iOS|macOS|
|:-:|:-:|
|||- 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](https://www.swift.org/package-manager/).
Embed in your SwiftUI view:
```swift
import SwiftUITabsViewstruct ContentView: View {
var body: some View {
TabsView(
tabs: /* [Tab] */,
selectedTab: /* Binding */,
barPosition: /* ToolbarPosition */,
ignoresKeyboard: /* Bool */,
frameChangeAnimation: /* Animation? */,
tabsBar: /* @ViewBuilder @escaping ([Tab], Binding) -> TabsBar */,
content: /* @ViewBuilder @escaping (Tab) -> TabContent */
)
}
}
```Check out [documentation comments](Sources/SwiftUITabsView/TabsView.swift) and the included [example app](Example/ExampleApp/Example.swift).
If your tab's content view is embedded in `NavigationView`, use [tabsBarSafeAreaInset](Sources/SwiftUITabsView/TabsBarSafeAreaInsetViewModifier.swift) modifier to apply safe area insets that matches the tabs bar:
```swift
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?
Consider supporting further development and buy me a coffee.
## 📄 License
Copyright © 2022 Dariusz Rybicki Darrarski
License: [MIT](LICENSE)