<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">If you'd like more context to the conversation:</div><div class=""><a href="http://ericasadun.com/2016/10/08/how-do-i-cast-an-optional-string-to-nsstring/" class="">How do I: Cast an optional string to NSString</a></div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 9, 2016, at 6:59 PM, Anton Zhilin &lt;<a href="mailto:antonyzhilin@gmail.com" class="">antonyzhilin@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important" class="">A quick fix:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class=""><code class="language-swift hljs" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)">guard <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">let</span> value = dict[<span class="hljs-string" style="color:rgb(221,17,68)">"Key"</span>].<span class="hljs-built_in" style="color:rgb(0,134,179)">map</span>({ $<span class="hljs-number" style="color:rgb(0,128,128)">0</span> <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">as</span> <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">NSString</span> }) {
    use(value)
}
</code></pre><p style="margin:0px 0px 1.2em!important" class="">Current behavior is quite logical: main purpose of <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="">as?</code> is to perform casts, which are not guaranteed to succeed. But I’d say that <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="">as?</code> should also support what you want.</p>
<div title="MDH:PGRpdj5BIHF1aWNrIGZpeDo8YnI+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5gYGBzd2lmdDwv
ZGl2PjxkaXY+Z3VhcmQgbGV0IHZhbHVlID0gZGljdFsiS2V5Il0ubWFwKHsgJDAgYXMgTlNTdHJp
bmcgfSkgezwvZGl2PjxkaXY+Jm5ic3A7ICZuYnNwOyB1c2UodmFsdWUpPC9kaXY+PGRpdj59PC9k
aXY+PGRpdj5gYGA8YnI+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5DdXJyZW50IGJlaGF2aW9y
IGlzIHF1aXRlIGxvZ2ljYWw6IG1haW4gcHVycG9zZSBvZiBgYXM/YCBpcyB0byBwZXJmb3JtIGNh
c3RzLCB3aGljaCBhcmUgbm90IGd1YXJhbnRlZWQgdG8gc3VjY2VlZC4gQnV0IEknZCBzYXkgdGhh
dCBgYXM/YCBzaG91bGQgYWxzbyBzdXBwb3J0IHdoYXQgeW91IHdhbnQuPC9kaXY+" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0" class="">​</div></div></div>
</div></blockquote></div><br class=""></body></html>