Add BIke Button
This commit is contained in:
parent
f6da6702a2
commit
2c898e5412
3 changed files with 24 additions and 6 deletions
|
|
@ -13,12 +13,22 @@ struct BikeSwipeView: TabContent {
|
|||
var body: some View {
|
||||
VStack{
|
||||
List {
|
||||
ForEach(bikes) { bike in
|
||||
Label(bike.name, systemImage: "bicycle")
|
||||
.foregroundStyle(.white)
|
||||
.padding(5)
|
||||
.background(bike.color)
|
||||
}.onDelete { bikes.remove(atOffsets: $0)}
|
||||
Section {
|
||||
ForEach(bikes) { bike in
|
||||
HStack{
|
||||
Label(bike.name, systemImage: "bicycle")
|
||||
.foregroundStyle(.white)
|
||||
.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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
"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" : {
|
||||
"comment" : "A word displayed in a list item.",
|
||||
"isCommentAutoGenerated" : true
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in a new issue