Skip to content

Commit 325a9e8

Browse files
authored
Merge pull request #470 from Esri/Caleb/Fix-SnapGeometryEditsSnapSettings
[Fix] `Snap geometry edits` snap settings
2 parents e3491e0 + 61fac28 commit 325a9e8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Shared/Samples/Snap geometry edits/SnapGeometryEditsView.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ struct SnapGeometryEditsView: View {
3737
/// The error shown in the error alert.
3838
@State private var error: Error?
3939

40-
/// A Boolean value indicating whether all the operational layers are loaded.
41-
@State private var layersAreLoaded = false
40+
/// A Boolean value indicating whether all the snap sources on the map view are loaded.
41+
@State private var snapSourcesAreLoaded = false
4242

4343
/// A Boolean value indicating whether the snap settings are presented.
4444
@State private var showsSnapSettings = false
4545

4646
var body: some View {
4747
MapView(map: map, graphicsOverlays: [model.geometryOverlay])
4848
.geometryEditor(model.geometryEditor)
49-
.task {
50-
// Load every layer in the web map when the sample starts.
51-
layersAreLoaded = await map.operationalLayers.load()
49+
.onDrawStatusChanged { drawStatus in
50+
guard !snapSourcesAreLoaded else { return }
51+
snapSourcesAreLoaded = drawStatus == .completed
5252
}
5353
.toolbar {
5454
ToolbarItemGroup(placement: .bottomBar) {
@@ -74,7 +74,7 @@ struct SnapGeometryEditsView: View {
7474
.presentationDetents([.fraction(0.6)])
7575
.frame(idealWidth: 320, idealHeight: 380)
7676
}
77-
.disabled(!layersAreLoaded)
77+
.disabled(!snapSourcesAreLoaded)
7878
}
7979
}
8080
.errorAlert(presentingError: $error)

0 commit comments

Comments
 (0)