Skip to content

Commit

Permalink
Show vehicle name properly
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelacaron committed Nov 24, 2023
1 parent ee0e0f7 commit bd51b19
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ struct OdometerView: View {
Text("\(reading.distance) \(reading.isMetric ? "km" : "mi")")
.font(.title3)

// Text("For \(reading.vehicle.name)")
let vehicleName = viewModel.vehicles.first { $0.id == reading.vehicleID }?.name
if let vehicleName {
Text("For \(vehicleName)")
}

Text("\(reading.date.formatted(date: .abbreviated, time: .omitted))")
}
Expand Down

0 comments on commit bd51b19

Please sign in to comment.