File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Shared/Samples/Find closest facility from point Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -169,19 +169,19 @@ private extension FindClosestFacilityFromPointView {
169169 // Create a route graphic for each incident in the result.
170170 let incidentsIndices = closestFacilityResult. incidents. indices
171171 let routeGraphics = incidentsIndices. compactMap { incidentIndex -> Graphic ? in
172- // Get the index for the facility closest to the given incident.
172+ // Get the index for the facility closest to the given incident and facility route .
173173 guard let closestFacilityIndex = closestFacilityResult. rankedIndexesOfFacilities (
174174 forIncidentAtIndex: incidentIndex
175- ) . first else { return nil }
176-
177- // Get the route for the facility and incident.
178- let closestFacilityRoute = closestFacilityResult . route (
179- toFacilityAtIndex : closestFacilityIndex ,
180- fromIncidentAtIndex : incidentIndex
181- )
175+ ) . first,
176+ let closestFacilityRoute = closestFacilityResult . route (
177+ toFacilityAtIndex : closestFacilityIndex ,
178+ fromIncidentAtIndex : incidentIndex
179+ ) else {
180+ return nil
181+ }
182182
183183 // Create a graphic using the route's geometry.
184- return Graphic ( geometry: closestFacilityRoute? . routeGeometry, symbol: routeSymbol)
184+ return Graphic ( geometry: closestFacilityRoute. routeGeometry, symbol: routeSymbol)
185185 }
186186
187187 graphicsOverlay. addGraphics ( routeGraphics)
You can’t perform that action at this time.
0 commit comments