fix(searchItem): fix step calculation and more info on location

This commit is contained in:
2024-12-04 14:38:23 +01:00
parent d5bada6793
commit c759d5e3b3
2 changed files with 20 additions and 11 deletions

View File

@@ -52,9 +52,18 @@ struct SearchItemView: View {
Spacer() Spacer()
} }
HStack { HStack {
Text("\(location.placemark.locality ?? "")") VStack(alignment: .leading) {
// .font(.) if (location.placemark.thoroughfare != nil) {
.foregroundStyle(.gray) Text(
"\(location.placemark.thoroughfare ?? "") \(location.placemark.subThoroughfare ?? "")"
)
.foregroundStyle(.gray)
}
if (location.placemark.locality != nil) {
Text("\(location.placemark.locality ?? "")")
.foregroundStyle(.gray)
}
}
Spacer() Spacer()
} }
} }
@@ -71,13 +80,13 @@ struct SearchItemView: View {
} }
) )
.frame(height: 100) .frame(height: 100)
// .onAppear { // .onAppear {
// findDirections() // findDirections()
// } // }
} }
func formatDistance(distance: CLLocationDistance) -> String { func formatDistance(distance: CLLocationDistance) -> String {
let steps = distance * (stepLength ?? 0) let steps = distance / (stepLength ?? 1)
if steps != 0 && showSteps { if steps != 0 && showSteps {
let formatter = NumberFormatter() let formatter = NumberFormatter()
formatter.maximumFractionDigits = 0 formatter.maximumFractionDigits = 0

View File

@@ -30,10 +30,10 @@ struct SearchView: View {
self.locations = [] self.locations = []
} }
} }
// .onAppear { // .onAppear {
// // TODO: delete this, it's for debug only // // TODO: delete this, it's for debug only
// search(for: self.query) // search(for: self.query)
// } // }
.overlay { .overlay {
HStack { HStack {
Spacer() Spacer()