https://github.com/simonnickel/snap-matching-navigation
A SwiftUI Container that displays a TabView or SplitScene, based on the device.
https://github.com/simonnickel/snap-matching-navigation
navigation swift swift-ui swiftui
Last synced: about 2 months ago
JSON representation
A SwiftUI Container that displays a TabView or SplitScene, based on the device.
- Host: GitHub
- URL: https://github.com/simonnickel/snap-matching-navigation
- Owner: simonnickel
- License: mit
- Created: 2024-04-15T10:08:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-28T22:53:59.000Z (8 months ago)
- Last Synced: 2025-05-13T12:52:28.468Z (2 months ago)
- Topics: navigation, swift, swift-ui, swiftui
- Language: Swift
- Homepage:
- Size: 356 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!CAUTION]
> This repository no longer active, it was replaced by [snap-navigation](https://github.com/simonnickel/snap-navigation).[](https://swiftpackageindex.com/simonnickel/snap-matching-navigation)
[](https://swiftpackageindex.com/simonnickel/snap-matching-navigation)> This package is part of the [SNAP](https://github.com/simonnickel/snap) suite.
// TODO: Replace with WWDC24 TabView
# SnapMatchingNavigation
Matching Navigation provides a SwiftUI container view that displays a TabView or SplitScene, based on the device.
[![Documentation][documentation badge]][documentation]
[documentation]: https://swiftpackageindex.com/simonnickel/snap-matching-navigation/main/documentation/snapmatchingnavigation
[documentation badge]: https://img.shields.io/badge/Documentation-DocC-blue## Demo
The [demo project](/SnapMatchingNavigationDemo) shows an example on how to use the package.
![]()
## How to use
```
MNavContainer(splitScene: {
NavigationSplitView {
Text("Sidebar")
} content: {
Text("Content")
} detail: {
Text("Detail")
}
}, tabScene: {
MNavTabScene(tabs: tabs, selected: $tabSelected, tabScreen: { tab in
})
})
```### MNavContainer
A container that either shows the `SplitScene` or the `TabScene` ViewBuilder based on device.
### MNavTabScene
A wrapper around TabView to expose the selected tab as a binding.