<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="">We can make the code condense when the optional is used <b class="">as a parameter</b>:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>/// Long version</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">if</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> doubleValue = json</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"taken_at"</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">double</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">createTime</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Date</span><span style="font-variant-ligatures: no-common-ligatures" class="">(timeIntervalSince1970:doubleValue)</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><p style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; min-height: 15px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">/// Shourt version</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">createTime</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = json</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">[</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"taken_at"</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">]</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">double</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">mapUnwrapped</span><span style="font-variant-ligatures: no-common-ligatures" class="">{ </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Date</span><span style="font-variant-ligatures: no-common-ligatures" class="">(timeIntervalSince1970:$0) }</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 6 Dec 2016, at 13:18, David Sweeris <<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 5, 2016, at 9:17 PM, David Sweeris via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 5, 2016, at 8:54 PM, Jay Zhao <<a href="mailto:zhaojianyin@icloud.com" class="">zhaojianyin@icloud.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">What about <span style="font-size: 14px;" class=""><font color="#38571a" class="">mapUnwrapped ?</font></span></div></div></div></blockquote><br class=""></div><div class="">If the name is anything other than “map”, you already have to think of the “special” word. At that point, why not just unwrap it manually?</div><div class=""><span class="" style="font-family: Menlo; font-size: 13px; font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">_</span><span class="" style="font-family: Menlo; font-size: 13px; font-variant-ligatures: no-common-ligatures;"> = array2?</span><span class="" style="font-family: Menlo; font-size: 13px; font-variant-ligatures: no-common-ligatures;">.</span><span class="" style="font-family: Menlo; font-size: 13px; font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">count</span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">vs</span></div><div class=""><span class="" style="font-family: Menlo; font-size: 13px; font-variant-ligatures: no-common-ligatures;"><span class="" style="color: rgb(186, 45, 162); font-variant-ligatures: no-common-ligatures;">_</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> = array2?</span><span class="" style="font-variant-ligatures: no-common-ligatures;">.map {$0.</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><font color="#703daa" class="">count</font>}</span></span></div></div></div></blockquote>Oops, there shouldn’t be a “?" on the last line</div></div></div></blockquote></div><br class=""></body></html>