Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-25T12:17:20.000Z (about 3 years ago)
- Last Synced: 2024-05-02T05:10:40.094Z (9 months 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
![Swift 5.5](https://img.shields.io/badge/swift-5.5-orange.svg)
![platform iOS 15 | macOS 12.1](https://img.shields.io/badge/platform-iOS_15_|_macOS_12-blue.svg)SwiftUI tabbed interface. Customizable replacement for `SwiftUI.TabView`.
|iOS|macOS|
|:-:|:-:|
|![Example iOS app light mode](Misc/ExampleApp-iOS-light.gif#gh-light-mode-only)![Example iOS app dark mode](Misc/ExampleApp-iOS-dark.gif#gh-dark-mode-only)|![Example macOS app light mode](Misc/ExampleApp-macOS-light.gif#gh-light-mode-only)![Example macOS app dark mode](Misc/ExampleApp-macOS-dark.gif#gh-dark-mode-only)|- 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)