Skip to content

Commit

Permalink
Build All Previews and Updated with Previewable
Browse files Browse the repository at this point in the history
  • Loading branch information
Yashraj49 committed Oct 14, 2024
1 parent 3c539e1 commit 228508d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,21 @@ struct EditMaintenanceEventView: View {
}
}

#Preview {
EditMaintenanceEventView(selectedEvent:
.constant(MaintenanceEvent(id: "",
userID: "",
vehicleID: "",
title: "",
date: Date(),
notes: "")),
viewModel:
DashboardViewModel(userUID: "")
#Preview() {

@Previewable @State var selectedEvent: MaintenanceEvent? = MaintenanceEvent(
id: UUID().uuidString,
userID: "user123",
vehicleID: "vehicle123",
title: "Oil Change",
date: Date(),
notes: "Changed engine oil"
)

var viewModel = DashboardViewModel(userUID: "user123")

EditMaintenanceEventView(
selectedEvent: $selectedEvent,
viewModel: viewModel
)
}
17 changes: 15 additions & 2 deletions Basic-Car-Maintenance/Shared/Settings/Views/EditVehicleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ struct EditVehicleView: View, Observable {
}

#Preview {
EditVehicleView(selectedVehicle: .constant(nil),
viewModel: SettingsViewModel(authenticationViewModel: AuthenticationViewModel()))

@Previewable @State var selectedVehicle: Vehicle? = Vehicle(
id: UUID().uuidString,
name: "Tesla Model S",
make: "Tesla",
model: "Model S",
year: "2020",
color: "Red",
vin: "5YJSA1E26JF123456",
licensePlateNumber: "ABC123"
)
var viewModel = SettingsViewModel(authenticationViewModel: AuthenticationViewModel())

EditVehicleView(selectedVehicle: $selectedVehicle, viewModel: viewModel)

}

0 comments on commit 228508d

Please sign in to comment.