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 |     // 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:/) |     // 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 { |     var body: some View { | ||||||
|         Map(position: $position) { |         Map(position: $position) { | ||||||
|             ForEach(0..<directions.count) { i in |             ForEach(0..<directions.count) { i in | ||||||
|   | |||||||
| @@ -70,9 +70,9 @@ struct SearchItemView: View { | |||||||
|             } |             } | ||||||
|         ) |         ) | ||||||
|         .frame(height: 100) |         .frame(height: 100) | ||||||
|         .onAppear { | //        .onAppear { | ||||||
|             findDirections() | //            findDirections() | ||||||
|         } | //        } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     func formatDistance(distance: CLLocationDistance) -> String { |     func formatDistance(distance: CLLocationDistance) -> String { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user