alles auf TabContent umgestellt
This commit is contained in:
parent
3e9762c3bf
commit
7aebdcefb1
9 changed files with 32 additions and 21 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
|
||||||
struct BikeView: View {
|
struct BikeView: TabContent {
|
||||||
static var title = "Bike"
|
static var title = "Bike"
|
||||||
static var image = "bicycle"
|
static var image = "bicycle"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,13 @@ enum TabLabel: String {
|
||||||
"hand.draw.fill"
|
"hand.draw.fill"
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
//
|
|
||||||
//func tab<C: TabContent>(_ contentType: C.Type)
|
func tab<C: TabContent>(_ contentType: C.Type)
|
||||||
//-> Tab<Never, C, DefaultTabLabel> {
|
-> Tab<Never, C, DefaultTabLabel> {
|
||||||
// Tab(C.title, systemImage: C.image) {
|
Tab(C.title, systemImage: C.image) {
|
||||||
// C()
|
C()
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -38,6 +38,12 @@ struct ContentView: View {
|
||||||
Tab("drücken", systemImage: TabLabel.cars.image) {
|
Tab("drücken", systemImage: TabLabel.cars.image) {
|
||||||
SwapperView()
|
SwapperView()
|
||||||
}
|
}
|
||||||
|
tab(ListView.self)
|
||||||
|
tab(CountView.self)
|
||||||
|
tab(BikeView.self)
|
||||||
|
tab(TrainView.self)
|
||||||
|
tab(SwapperView.self)
|
||||||
|
tab(PaddingView.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct CountView: View, TabContent {
|
struct CountView: TabContent {
|
||||||
static var title = "Count"
|
static var title = "Count"
|
||||||
static var image = "42.circle"
|
static var image = "42.circle"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import SwiftUI
|
||||||
//import Playgrounds
|
//import Playgrounds
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
struct ListView: View , TabContent{
|
struct ListView: TabContent{
|
||||||
static var title = "List"
|
static var title = "List"
|
||||||
static var image = "list.bullet"
|
static var image = "list.bullet"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,8 @@ protocol Vehicle {
|
||||||
var color: Color { get set }
|
var color: Color { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol TabContent {
|
protocol TabContent: View {
|
||||||
init() //title: String, image: String)
|
init()
|
||||||
|
|
||||||
// <#statements#>
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
static var title: String { get }
|
static var title: String { get }
|
||||||
static var image: String { get }
|
static var image: String { get }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,21 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct PaddingView: View {
|
struct PaddingView: TabContent {
|
||||||
|
static var title = "Padding"
|
||||||
|
static var image = "pad.header"
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Text("Hello, World!")
|
Color.black
|
||||||
.padding()
|
.padding()
|
||||||
|
.background(.green)
|
||||||
|
.padding()
|
||||||
|
.background(.blue)
|
||||||
|
.padding()
|
||||||
|
.background(.red)
|
||||||
|
.frame(width: 380, height: 380)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
PaddingView()
|
PaddingView()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct SwapperView: View{
|
struct SwapperView: TabContent {
|
||||||
static var title = "Swap"
|
static var title = "Swap"
|
||||||
static var image = "rectangle.2.swap"
|
static var image = "rectangle.2.swap"
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -3,7 +3,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
|
||||||
struct TrainView: View , TabContent {
|
struct TrainView: TabContent {
|
||||||
static var title = "Train"
|
static var title = "Train"
|
||||||
static var image = "train.side.front.car"
|
static var image = "train.side.front.car"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue