BikeView mit ForEach
This commit is contained in:
parent
8eef26c4a4
commit
37ae8487be
3 changed files with 10 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ import SwiftUI
|
||||||
struct TheSwiftWeek: App {
|
struct TheSwiftWeek: App {
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
WindowGroup {
|
||||||
Text("Moin")
|
BikeView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,16 @@
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
|
||||||
struct BikeView: View {
|
struct BikeView: View {
|
||||||
|
var bike = Bike(name: "Fahrrad", color: "lila")
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
Text(bike.description)
|
||||||
|
Text(bike.name)
|
||||||
|
ForEach(1...5, id: \.self) { number in
|
||||||
|
Text(bike.color + " " + String(number))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in a new issue