https://github.com/schwa/yatabview
Yet Another SwiftUI TabView and Picker replacement.
https://github.com/schwa/yatabview
Last synced: 4 months ago
JSON representation
Yet Another SwiftUI TabView and Picker replacement.
- Host: GitHub
- URL: https://github.com/schwa/yatabview
- Owner: schwa
- License: mit
- Created: 2025-01-04T07:07:35.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-04T07:28:59.000Z (4 months ago)
- Last Synced: 2025-01-12T11:50:09.406Z (4 months ago)
- Language: Swift
- Size: 325 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YATabView
Yet Another SwiftUI TabView and Picker replacement.
`YATabView` is inspired by the Xcode inspector style tab view. `YAPicker` came along for the ride.
![alt text]()
## Installation
```sh
swift package add-dependency https://github.com/schwa/YATabView --branch main
swift package add-target-dependency YATabView
```## Usage
`YATabView` emulates `TabView`'s API. But all tabs need a `.tag()` modifier added _and_ the tab view must support a `selection` binding (selections can optionally be optional). This is a limitation of the current implementation and can be improved in the future. Instead of `.tabItem()` use `.yaTabItem()`.
```swift
#Preview {
@Previewable @State
var selection: Int = 1YATabView(selection: $selection) {
Text("String-1")
.tag(1)
.yaTabItem { Image(systemName: "1.circle") }
Text("String-2")
.tag(2)
.yaTabItem { Image(systemName: "2.circle") }
}
}
````YATabView` is made uses a `YAPicker` to control the tab selection. `YAPicker` can be somewhat configured by implementing the `YAPickerCellStyle` and setting it with the `.yaPickerCellStyle()` modifier.