<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic What happened to the geometryType enum in 200.0? in Swift Maps SDK Questions</title>
    <link>https://community.esri.com/t5/swift-maps-sdk-questions/what-happened-to-the-geometrytype-enum-in-200-0/m-p/1275942#M51</link>
    <description>&lt;P&gt;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.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Apr 2023 19:13:09 GMT</pubDate>
    <dc:creator>GBreen</dc:creator>
    <dc:date>2023-04-05T19:13:09Z</dc:date>
    <item>
      <title>What happened to the geometryType enum in 200.0?</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/what-happened-to-the-geometrytype-enum-in-200-0/m-p/1275942#M51</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 19:13:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/what-happened-to-the-geometrytype-enum-in-200-0/m-p/1275942#M51</guid>
      <dc:creator>GBreen</dc:creator>
      <dc:date>2023-04-05T19:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: What happened to the geometryType enum in 200.0?</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/what-happened-to-the-geometrytype-enum-in-200-0/m-p/1275951#M52</link>
      <description>&lt;P&gt;Hope you don't mind, I moved this question to the new&amp;nbsp;Swift Maps SDK Questions forum.&lt;/P&gt;&lt;P&gt;In 200.x we get rid of the previous&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;geometryType&lt;/EM&gt; property of a geometry, and rely on the &lt;A href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/types#Metatype-Type" target="_self"&gt;metatype&lt;/A&gt;&amp;nbsp;of a type, to better follow Swift conventions.&amp;nbsp;Metatypes are used extensively throughout the standard library.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Below is the comparison between the old and new way.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;// 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.")
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-ios/blob/main/arcgis-ios-sdk-samples/Geometry/Spatial%20relationships/SpatialRelationshipsViewController.swift#L174" target="_self"&gt;&lt;SPAN&gt;A 100.x sample snippet&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;that shows how to switch the&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;geometryType&amp;nbsp;&lt;/EM&gt;&lt;/SPAN&gt;property&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-swift-samples/blob/main/Shared/Samples/Show%20result%20of%20spatial%20relationships/ShowResultOfSpatialRelationshipsView.swift#L221" target="_blank" rel="noopener noreferrer"&gt;A 200.x sample snippet&lt;/A&gt;&amp;nbsp;that shows how to add a convenience extension to the Geometry type to decide what specific geometry it is&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://stackoverflow.com/questions/25724527" target="_self"&gt;Here is a Stack Overflow thread&lt;/A&gt;&amp;nbsp;that discusses various type casting strategies for a Swift enum&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/typecasting/" target="_self"&gt;Type Casting&lt;/A&gt; from Swift.org doc&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 05 Apr 2023 19:32:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/what-happened-to-the-geometrytype-enum-in-200-0/m-p/1275951#M52</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2023-04-05T19:32:21Z</dc:date>
    </item>
  </channel>
</rss>

