47 lines
940 B
Swift
47 lines
940 B
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 {
|
|
var body: some View {
|
|
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()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
ContentView()
|
|
}
|