diff --git a/BikeSwipeView.swift b/BikeSwipeView.swift index fee5c49..44b3eb8 100644 --- a/BikeSwipeView.swift +++ b/BikeSwipeView.swift @@ -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)) + } + } } diff --git a/Localizable.xcstrings b/Localizable.xcstrings index eed91a9..ab819e4 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -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 diff --git a/TheSwiftWeek.xcodeproj/project.xcworkspace/xcuserdata/rohing73.xcuserdatad/UserInterfaceState.xcuserstate b/TheSwiftWeek.xcodeproj/project.xcworkspace/xcuserdata/rohing73.xcuserdatad/UserInterfaceState.xcuserstate index e4a4eff..db9ba0d 100644 Binary files a/TheSwiftWeek.xcodeproj/project.xcworkspace/xcuserdata/rohing73.xcuserdatad/UserInterfaceState.xcuserstate and b/TheSwiftWeek.xcodeproj/project.xcworkspace/xcuserdata/rohing73.xcuserdatad/UserInterfaceState.xcuserstate differ