<?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 Re: Capturing GPS coordinates. in Swift Maps SDK Questions</title>
    <link>https://community.esri.com/t5/swift-maps-sdk-questions/capturing-gps-coordinates/m-p/1247718#M18</link>
    <description>&lt;P&gt;Please see the attached demo. Use a moving simulated location on Simulator (e.g., Features &amp;gt; Location &amp;gt; City Run) to see how it works.&lt;/P&gt;&lt;P&gt;The key is to understand the &lt;STRONG&gt;&lt;A href="https://developer.apple.com/documentation/swift/asyncstream" target="_self"&gt;AsyncStream&lt;/A&gt;&lt;/STRONG&gt;&amp;nbsp;concept in the relatively new Swift Concurrency.&lt;/P&gt;&lt;P data-unlink="true"&gt;As you noticed, the doc of&amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/locationdatasource/locations" target="_self"&gt;&lt;SPAN&gt;LocationDataSource.locations&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;shows its type as&amp;nbsp;&lt;STRONG&gt;AsyncStream&amp;lt;Location&amp;gt;&lt;/STRONG&gt;&lt;SPAN&gt;. That means you&amp;nbsp;can use the&amp;nbsp;for-await-in&amp;nbsp;syntax to process its updates as the stream produces it, such as&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;for await newLocation in locationDisplay.dataSource.locations {
    // currentLocation = newLocation
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I haven't written a sample for it yet, but in the upcoming months a few more examples regarding the asynchronous stream pattern will be added to the sample viewer.&lt;/P&gt;&lt;P&gt;Furthermore, we are planning to publish a series of blogposts to introduce the various new concepts that come along with the new ArcGIS Maps SDK for Swift together with SwiftUI and Swift Concurrency, etc. Stay tuned!&lt;/P&gt;&lt;P&gt;p.s. the doc is not accurate, and we will reword it in the future.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2023 21:07:05 GMT</pubDate>
    <dc:creator>Ting</dc:creator>
    <dc:date>2023-01-12T21:07:05Z</dc:date>
    <item>
      <title>Capturing GPS coordinates.</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/capturing-gps-coordinates/m-p/1247519#M17</link>
      <description>&lt;P&gt;I need to capture several GPS points and then average them. &amp;nbsp;In version 100, I accomplished this by adding an observer to locationDisplay for keyPath:location. &amp;nbsp;Not sure how to do this in version 200. &amp;nbsp;Is there an example? &amp;nbsp;From what I can tell, I need to add a callback handler to the LocationDataSource object? &amp;nbsp;If so, how do I do that?&lt;/P&gt;&lt;P&gt;From Documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/locationdatasource/locations" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; &lt;SPAN class=""&gt;locations&lt;/SPAN&gt;&lt;SPAN class=""&gt;: &lt;/SPAN&gt;&lt;SPAN class=""&gt;AsyncStream&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;Location&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;Set the location changed callback function for the location data source.&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 12 Jan 2023 01:20:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/capturing-gps-coordinates/m-p/1247519#M17</guid>
      <dc:creator>DuanePfeiffer</dc:creator>
      <dc:date>2023-01-12T01:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing GPS coordinates.</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/capturing-gps-coordinates/m-p/1247718#M18</link>
      <description>&lt;P&gt;Please see the attached demo. Use a moving simulated location on Simulator (e.g., Features &amp;gt; Location &amp;gt; City Run) to see how it works.&lt;/P&gt;&lt;P&gt;The key is to understand the &lt;STRONG&gt;&lt;A href="https://developer.apple.com/documentation/swift/asyncstream" target="_self"&gt;AsyncStream&lt;/A&gt;&lt;/STRONG&gt;&amp;nbsp;concept in the relatively new Swift Concurrency.&lt;/P&gt;&lt;P data-unlink="true"&gt;As you noticed, the doc of&amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/locationdatasource/locations" target="_self"&gt;&lt;SPAN&gt;LocationDataSource.locations&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;shows its type as&amp;nbsp;&lt;STRONG&gt;AsyncStream&amp;lt;Location&amp;gt;&lt;/STRONG&gt;&lt;SPAN&gt;. That means you&amp;nbsp;can use the&amp;nbsp;for-await-in&amp;nbsp;syntax to process its updates as the stream produces it, such as&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;for await newLocation in locationDisplay.dataSource.locations {
    // currentLocation = newLocation
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I haven't written a sample for it yet, but in the upcoming months a few more examples regarding the asynchronous stream pattern will be added to the sample viewer.&lt;/P&gt;&lt;P&gt;Furthermore, we are planning to publish a series of blogposts to introduce the various new concepts that come along with the new ArcGIS Maps SDK for Swift together with SwiftUI and Swift Concurrency, etc. Stay tuned!&lt;/P&gt;&lt;P&gt;p.s. the doc is not accurate, and we will reword it in the future.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 21:07:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/capturing-gps-coordinates/m-p/1247718#M18</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2023-01-12T21:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Capturing GPS coordinates.</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/capturing-gps-coordinates/m-p/1270111#M39</link>
      <description>&lt;P&gt;update: doc will be updated in next release.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 21:15:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/capturing-gps-coordinates/m-p/1270111#M39</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2023-03-21T21:15:20Z</dc:date>
    </item>
  </channel>
</rss>

