Skip to content

Commit ca30768

Browse files
committed
Move VStack and toolbar placement
1 parent 092b4fd commit ca30768

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

Shared/Samples/Augment reality to navigate route/AugmentRealityToNavigateRouteView.swift

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ struct AugmentRealityToNavigateRouteView: View {
5151
}
5252

5353
var body: some View {
54-
VStack(spacing: 0) {
55-
if isShowingRoutePlanner {
56-
RoutePlannerView(isShowing: $isShowingRoutePlanner)
57-
.onDidSelectRoute { routeGraphic, routeResult in
58-
self.routeResult = routeResult
59-
graphicsOverlay = makeRouteOverlay(
60-
routeResult: routeResult,
61-
routeGraphic: routeGraphic
62-
)
63-
}
64-
.task {
65-
try? await elevationSource.load()
66-
}
67-
} else {
54+
if isShowingRoutePlanner {
55+
RoutePlannerView(isShowing: $isShowingRoutePlanner)
56+
.onDidSelectRoute { routeGraphic, routeResult in
57+
self.routeResult = routeResult
58+
graphicsOverlay = makeRouteOverlay(
59+
routeResult: routeResult,
60+
routeGraphic: routeGraphic
61+
)
62+
}
63+
.task {
64+
try? await elevationSource.load()
65+
}
66+
} else {
67+
VStack(spacing: 0) {
6868
WorldScaleSceneView { _ in
6969
SceneView(scene: scene, graphicsOverlays: [graphicsOverlay])
7070
}
@@ -89,22 +89,22 @@ struct AugmentRealityToNavigateRouteView: View {
8989
.onDisappear {
9090
Task { await locationDataSource.stop() }
9191
}
92+
Divider()
9293
}
93-
Divider()
94-
}
95-
.toolbar {
96-
ToolbarItemGroup(placement: .bottomBar) {
97-
Button("Start") {
98-
isNavigating = true
99-
Task {
100-
do {
101-
try await startNavigation()
102-
} catch {
103-
print("Failed to start navigation.")
94+
.toolbar {
95+
ToolbarItemGroup(placement: .bottomBar) {
96+
Button("Start") {
97+
isNavigating = true
98+
Task {
99+
do {
100+
try await startNavigation()
101+
} catch {
102+
print("Failed to start navigation.")
103+
}
104104
}
105105
}
106+
.disabled(isNavigating)
106107
}
107-
.disabled(isNavigating)
108108
}
109109
}
110110
}

0 commit comments

Comments
 (0)