Add BIke Button

This commit is contained in:
Ingo Rohlf 2025-10-22 14:33:23 +02:00
parent f6da6702a2
commit 2c898e5412
3 changed files with 24 additions and 6 deletions

View file

@ -13,12 +13,22 @@ struct BikeSwipeView: TabContent {
var body: some View { var body: some View {
VStack{ VStack{
List { List {
ForEach(bikes) { bike in Section {
Label(bike.name, systemImage: "bicycle") ForEach(bikes) { bike in
.foregroundStyle(.white) HStack{
.padding(5) Label(bike.name, systemImage: "bicycle")
.background(bike.color) .foregroundStyle(.white)
}.onDelete { bikes.remove(atOffsets: $0)} .padding(5)
.background(bike.color)
Text(bike.id.uuidString.components(separatedBy: "-").first!)
}
}.onDelete { bikes.remove(atOffsets: $0)}
.navigationTitle(Text("Bikes"))
} footer: {
Button("Add Bike"){
bikes.append(Bike(name: "New Bike", price: 1.00, color: Color.blue))
}
}
} }

View file

@ -5,6 +5,14 @@
"comment" : "A text element displaying a number. The content of the text element is the integer passed to this view's initializer.", "comment" : "A text element displaying a number. The content of the text element is the integer passed to this view's initializer.",
"isCommentAutoGenerated" : true "isCommentAutoGenerated" : true
}, },
"Add Bike" : {
"comment" : "A button that adds a new bike to the list of bikes.",
"isCommentAutoGenerated" : true
},
"Bikes" : {
"comment" : "The title of the list section in the BikeSwipe tab.",
"isCommentAutoGenerated" : true
},
"Buzz" : { "Buzz" : {
"comment" : "A word displayed in a list item.", "comment" : "A word displayed in a list item.",
"isCommentAutoGenerated" : true "isCommentAutoGenerated" : true