<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=""><br class=""><div class="">Since the XML and JSON related objects are part of Foundation, I think it would be great to have that functionality in Foundation as well. For “true”, “false”, “1” and “0” (in addition to 1 and 0).</div><div class=""><br class=""></div><div class="">Mirek</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jun 4, 2016, at 06:10, Arsen Gasparyan 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=""><div dir="ltr" class="">Hello,<div class=""><br class=""></div><div class="">It would be great if we had `<span style="color:rgb(51,51,51);font-size:12px;white-space:pre-wrap" class="">init?(_ text: </span><span class="inbox-code-object" style="font-size:12px;white-space:pre-wrap;color:rgb(145,0,145)">String</span><span style="color:rgb(51,51,51);font-size:12px;white-space:pre-wrap" class="">)</span>` for Bool class. Because sometime when you're processing JSON/XML it can help you a lot.</div><div class=""><br class=""></div><div class="">Examples:</div><div class=""><br class=""></div><div class=""><pre class="inbox-code-java" style="margin-top:0px;margin-bottom:0px;padding:0px;max-height:30em;overflow:auto;white-space:pre-wrap;word-wrap:normal;color:rgb(51,51,51);font-size:12px">Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"<span class="inbox-code-keyword">true</span>"</span>) -> <span class="inbox-code-keyword" style="color:rgb(0,0,145)">true</span>
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"<span class="inbox-code-keyword">false</span>"</span>) -> <span class="inbox-code-keyword" style="color:rgb(0,0,145)">false</span>
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"TrUE"</span>) -> <span class="inbox-code-keyword" style="color:rgb(0,0,145)">true</span>
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">" <span class="inbox-code-keyword">true</span> "</span>) -> nil
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"1"</span>) -> nil
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"Y"</span>) -> nil
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"whatever"</span>) -> nil </pre><pre class="inbox-code-java" style="margin-top:0px;margin-bottom:0px;padding:0px;max-height:30em;overflow:auto;white-space:pre-wrap;word-wrap:normal;color:rgb(51,51,51);font-size:12px"><br class=""></pre><pre class="inbox-code-java" style="margin-top:0px;margin-bottom:0px;padding:0px;max-height:30em;overflow:auto;white-space:pre-wrap;word-wrap:normal;color:rgb(51,51,51);font-size:12px"><br class=""></pre></div>via <a href="https://bugs.swift.org/browse/SR-1282" class="">https://bugs.swift.org/browse/SR-1282</a><div class=""><br class=""></div><div class="">Thanks.</div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>