Skip to content

Commit 89bc344

Browse files
committed
Address PR feedback
1 parent 25c0eb1 commit 89bc344

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Shared/Samples/Create and edit geometries/CreateAndEditGeometriesView.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct CreateAndEditGeometriesView: View {
5151
),
5252
let graphic = identifyResult.graphics.first,
5353
!model.isStarted else { return }
54-
model.startEditing(withGraphic: graphic)
54+
model.startEditing(with: graphic)
5555
}
5656
}
5757
}
@@ -382,11 +382,11 @@ private class GeometryEditorModel: ObservableObject {
382382

383383
/// Updates the selected graphic with the current geometry.
384384
private func updateGraphic() {
385-
defer { selectedGraphic = nil }
386385
guard let selectedGraphic else { return }
387386
selectedGraphic.geometry = geometryEditor.stop()
388387
isStarted = false
389388
selectedGraphic.isVisible = true
389+
self.selectedGraphic = nil
390390
}
391391

392392
/// Adds a new graphic for the current geometry to the graphics overlay.
@@ -453,7 +453,6 @@ private class GeometryEditorModel: ObservableObject {
453453
/// - tool: The tool to draw with.
454454
/// - geometryType: The type of geometry to draw.
455455
func startEditing(with tool: GeometryEditorTool, geometryType: Geometry.Type) {
456-
selectedGraphic = nil
457456
configureGeometryEditorTool(tool, scaleMode: scaleMode)
458457
geometryEditor.tool = tool
459458
geometryEditor.start(withType: geometryType)
@@ -462,8 +461,8 @@ private class GeometryEditorModel: ObservableObject {
462461

463462
/// Starts editing a given graphic with the geometry editor.
464463
/// - Parameter graphic: The graphic to edit.
465-
func startEditing(withGraphic graphic: Graphic) {
466-
guard let geometry = graphic.geometry else { return }
464+
func startEditing(with graphic: Graphic) {
465+
let geometry = graphic.geometry!
467466

468467
switch geometry {
469468
case is Point, is Multipoint:

0 commit comments

Comments
 (0)