59 lines
1.3 KiB
Swift
59 lines
1.3 KiB
Swift
|
|
|
|
import SwiftUI
|
|
|
|
enum TabLabel: String {
|
|
case bikes
|
|
case trains
|
|
case cars
|
|
var title: String { rawValue.capitalized }
|
|
var image: String { switch self {
|
|
case .bikes:
|
|
"bicycle"
|
|
case .trains:
|
|
"train.side.front.car"
|
|
case .cars:
|
|
"hand.draw.fill"
|
|
} }
|
|
}
|
|
|
|
func tab<C: TabContent>(_ contentType: C.Type )
|
|
-> Tab<Never, C, DefaultTabLabel> {
|
|
Tab(C.title, systemImage: C.image ) {
|
|
C()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
struct ContentView: View {
|
|
@AppStorage("tabSelection") var tabSelection = TabLabel.bikes
|
|
|
|
|
|
var body: some View {
|
|
//TabView(selection: $tabSelection) {
|
|
TabView() {
|
|
// Tab(TabLabel.bikes.title, systemImage: TabLabel.bikes.image) {
|
|
// BikeView()
|
|
// }
|
|
// Tab(TabLabel.bikes.title, systemImage: TabLabel.trains.image) {
|
|
// TrainView()
|
|
// }
|
|
// Tab("drücken", systemImage: TabLabel.cars.image) {
|
|
// SwapperView()
|
|
// }
|
|
tab(ListView.self)
|
|
tab(CountView.self)
|
|
tab(BikeView.self)
|
|
tab(BikeSwipeView.self)
|
|
tab(TrainView.self)
|
|
tab(SwapperView.self)
|
|
tab(PaddingView.self)
|
|
tab(RangeView.self)
|
|
}.tabViewStyle(.sidebarAdaptable)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
ContentView()
|
|
}
|