<?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 AGSPortalUser﻿ nullable properties in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/agsportaluser-nullable-properties/m-p/93465#M926</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: rgba(0, 0, 0, 0.85); background-color: #ffffff; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;All the properties of &lt;STRONG&gt;AGSPortalUser&lt;/STRONG&gt;&amp;nbsp;are &amp;nbsp;&lt;STRONG&gt;nullable&lt;/STRONG&gt;.&lt;/P&gt;&lt;P style="color: rgba(0, 0, 0, 0.85); background-color: #ffffff; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/P&gt;&lt;P style="color: rgba(0, 0, 0, 0.85); background-color: #ffffff; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The question: is it even possible in practice to have AGSPortalUser instance with&amp;nbsp;&lt;STRONG&gt;username&lt;/STRONG&gt; to be &lt;STRONG&gt;null&lt;/STRONG&gt;?&lt;/P&gt;&lt;P style="color: rgba(0, 0, 0, 0.85); background-color: #ffffff; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;I'm trying to relay on this property as a unique identifier of the user and want to be sure if I can force unwrap it with Swift safely.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Oct 2019 12:53:44 GMT</pubDate>
    <dc:creator>SerhiiKyrylenko</dc:creator>
    <dc:date>2019-10-04T12:53:44Z</dc:date>
    <item>
      <title>AGSPortalUser﻿ nullable properties</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/agsportaluser-nullable-properties/m-p/93465#M926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: rgba(0, 0, 0, 0.85); background-color: #ffffff; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;All the properties of &lt;STRONG&gt;AGSPortalUser&lt;/STRONG&gt;&amp;nbsp;are &amp;nbsp;&lt;STRONG&gt;nullable&lt;/STRONG&gt;.&lt;/P&gt;&lt;P style="color: rgba(0, 0, 0, 0.85); background-color: #ffffff; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/P&gt;&lt;P style="color: rgba(0, 0, 0, 0.85); background-color: #ffffff; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The question: is it even possible in practice to have AGSPortalUser instance with&amp;nbsp;&lt;STRONG&gt;username&lt;/STRONG&gt; to be &lt;STRONG&gt;null&lt;/STRONG&gt;?&lt;/P&gt;&lt;P style="color: rgba(0, 0, 0, 0.85); background-color: #ffffff; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;I'm trying to relay on this property as a unique identifier of the user and want to be sure if I can force unwrap it with Swift safely.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2019 12:53:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/agsportaluser-nullable-properties/m-p/93465#M926</guid>
      <dc:creator>SerhiiKyrylenko</dc:creator>
      <dc:date>2019-10-04T12:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: AGSPortalUser﻿ nullable properties</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/agsportaluser-nullable-properties/m-p/93466#M927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the portal user object has failed to load, you might see null. And if the JSON that Runtime gets back from the service is corrupted somehow, then it's technically possible for the username to be null while the JSON was parsed properly. That's clearly&amp;nbsp;an unexpected and highly unlikely edge-case. I myself would not code expecting that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in&amp;nbsp;general, I would approach something like this with a guard let statement and/or a precondition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;guard &lt;SPAN class="keyword token"&gt;let&lt;/SPAN&gt; username &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; user&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;username &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="token function"&gt;preconditionFailure&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Username unexpectedly nil"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will help you during testing to isolate any issues. You could also handle the case more gracefully than with a&amp;nbsp;preconditionFailure() if need be.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:34:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/agsportaluser-nullable-properties/m-p/93466#M927</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2021-12-10T23:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: AGSPortalUser﻿ nullable properties</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/agsportaluser-nullable-properties/m-p/93467#M928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2019 10:41:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/agsportaluser-nullable-properties/m-p/93467#M928</guid>
      <dc:creator>SerhiiKyrylenko</dc:creator>
      <dc:date>2019-10-07T10:41:51Z</dc:date>
    </item>
  </channel>
</rss>

