fix(search): only calculate route when user clicks on the search result
This commit is contained in:
		| @@ -32,6 +32,10 @@ struct ContentView: View { | ||||
|     // show how long does the route take with said walking speed | ||||
|     // Add favorite locations - like home, work, etc (probably should be stored in core data tho:/) | ||||
|  | ||||
|      | ||||
|     // How to speed up? | ||||
|     // calculate only the distance between the start and end instead of getting directions for everything | ||||
|     // if user clicks on the place, display better view and then calculate route there | ||||
|     var body: some View { | ||||
|         Map(position: $position) { | ||||
|             ForEach(0..<directions.count) { i in | ||||
|   | ||||
| @@ -70,9 +70,9 @@ struct SearchItemView: View { | ||||
|             } | ||||
|         ) | ||||
|         .frame(height: 100) | ||||
|         .onAppear { | ||||
|             findDirections() | ||||
|         } | ||||
| //        .onAppear { | ||||
| //            findDirections() | ||||
| //        } | ||||
|     } | ||||
|  | ||||
|     func formatDistance(distance: CLLocationDistance) -> String { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user