@@ -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