Skip to content

Commit 3da9b57

Browse files
committed
Update parameters loading.
#293 (comment)
1 parent b2d7342 commit 3da9b57

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Shared/Samples/Find route in mobile map package/FindRouteInMobileMapPackageView.MobileMapView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ extension FindRouteInMobileMapPackageView {
9494
}
9595
}
9696
.task {
97-
// Load the default route parameters from the route task when the sample loads.
97+
// Load the route parameters sample loads.
9898
do {
99-
model.routeParameters = try await model.routeTask?.makeDefaultParameters()
99+
try await model.loadRouteParameters()
100100
} catch {
101101
self.error = error
102102
}

Shared/Samples/Find route in mobile map package/FindRouteInMobileMapPackageView.Models.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ extension FindRouteInMobileMapPackageView.MobileMapView {
110110
let routeTask: RouteTask?
111111

112112
/// The route parameters for routing with the route task.
113-
var routeParameters: RouteParameters?
113+
private var routeParameters: RouteParameters?
114114

115115
/// The locator task for reverse geocoding.
116116
private let locatorTask: LocatorTask
@@ -149,6 +149,11 @@ extension FindRouteInMobileMapPackageView.MobileMapView {
149149

150150
// MARK: Methods
151151

152+
/// Loads the route parameters from the route task.
153+
func loadRouteParameters() async throws {
154+
routeParameters = try await routeTask?.makeDefaultParameters()
155+
}
156+
152157
/// Updates the marker to a given point or adds a new marker if there isn't one yet.
153158
/// - Parameter point: The point to set the marker to.
154159
func updateMarker(to point: Point) {

0 commit comments

Comments
 (0)