Select to view content in your preferred language

GeometryEditor().start(withType: Geometry.Type) isn't working as expected

587
1
Jump to solution
05-09-2023 06:41 AM
Torgeir
New Contributor

In the beta version of the SDK we used: GeometryEditor().start(creationMode: .polyline) which did work as expected, pretty easy to use and now after release we have GeometryEditor().start(withType: Geometry.Type) but I can't seem to find a way to get a Geometry.Type from anything.

The issue here is that we can't get the type from anything to start a new geometry editing session.

I have tried: Polyline, Polyline.Type, .polyline and more but not getting me anywhere, what should I use as Geometry.Type? And what is the best practice to create a new Geometry while letting the user edit the geometry?

1 Solution

Accepted Solutions
rolson_esri
Deactivated User

It's a good question. The answer is to use the Swift metatype.  That looks like this:

`Point.self`, `Polyline.self`, `Polygon.self`, etc:

 

geometryEditor.start(withType: Polyline.self)

 

We have a very nice sample that shows how to work with the GeometryEditor. Please take a look at it as well for more information.  Try cloning the samples repo, build and use the samples app, and dig into the code.

Also, note that a related question was answered here.

View solution in original post

1 Reply
rolson_esri
Deactivated User

It's a good question. The answer is to use the Swift metatype.  That looks like this:

`Point.self`, `Polyline.self`, `Polygon.self`, etc:

 

geometryEditor.start(withType: Polyline.self)

 

We have a very nice sample that shows how to work with the GeometryEditor. Please take a look at it as well for more information.  Try cloning the samples repo, build and use the samples app, and dig into the code.

Also, note that a related question was answered here.