In 100.0 you could decide the type of a geometry via a GeometryType enum, but that doesn't seem to exist in 200.0.
Solved! Go to Solution.
Hope you don't mind, I moved this question to the new Swift Maps SDK Questions forum.
In 200.x we get rid of the previous geometryType property of a geometry, and rely on the metatype of a type, to better follow Swift conventions. Metatypes are used extensively throughout the standard library.
Below is the comparison between the old and new way.
// 100.x
switch geometryType {
case .point: return "Point"
case .polyline: return "Polyline"
case .polygon: return "Polygon"
default:
return nil
}
// 200.x
switch geometry {
case is Point: return "Point"
case is Polyline: return "Polyline"
case is ArcGIS.Polygon: return "Polygon"
default:
return nil
}
// or sth like…
let geometryType: Geometry.Type = ...
switch geometryType {
case is Point.Type:
print("Point!")
default:
print("Not Point.")
}
Hope you don't mind, I moved this question to the new Swift Maps SDK Questions forum.
In 200.x we get rid of the previous geometryType property of a geometry, and rely on the metatype of a type, to better follow Swift conventions. Metatypes are used extensively throughout the standard library.
Below is the comparison between the old and new way.
// 100.x
switch geometryType {
case .point: return "Point"
case .polyline: return "Polyline"
case .polygon: return "Polygon"
default:
return nil
}
// 200.x
switch geometry {
case is Point: return "Point"
case is Polyline: return "Polyline"
case is ArcGIS.Polygon: return "Polygon"
default:
return nil
}
// or sth like…
let geometryType: Geometry.Type = ...
switch geometryType {
case is Point.Type:
print("Point!")
default:
print("Not Point.")
}