<div dir="ltr">Agree about "1" and "0" because it's a valid XML boolean value. But I don't know where you can find "yes" / "no" value.<div><br></div><div><a href="http://www.w3schools.com/xml/schema_dtypes_misc.asp">http://www.w3schools.com/xml/schema_dtypes_misc.asp</a><br></div>Note: Legal values for boolean are true, false, 1 (which indicates true), and 0 (which indicates false).</div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jun 4, 2016 at 4:14 PM Leonardo Pessoa <<a href="mailto:me@lmpessoa.com">me@lmpessoa.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div style="font-family:Calibri,sans-serif;font-size:11pt">I think it would be interesting if it could also recognise "1" and "yes" too as it can be useful in some cases. Perhaps have an option for this converter to be customised.<br><br>L</div></div><div dir="ltr"><hr><span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">From: </span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:swift-evolution@swift.org" target="_blank">Arsen Gasparyan via swift-evolution</a></span><br><span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Sent: </span><span style="font-family:Calibri,sans-serif;font-size:11pt">04/06/2016 10:10 AM</span><br><span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">To: </span><span style="font-family:Calibri,sans-serif;font-size:11pt"><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span style="font-family:Calibri,sans-serif;font-size:11pt;font-weight:bold">Subject: </span><span style="font-family:Calibri,sans-serif;font-size:11pt">[swift-evolution] Add conversion String -> Bool</span><br><br></div></div><div><div dir="ltr">Hello,<div><br></div><div>It would be great if we had `<span style="color:rgb(51,51,51);font-size:12px;white-space:pre-wrap">init?(_ text: </span><span style="color:rgb(145,0,145);font-size:12px;white-space:pre-wrap">String</span><span style="color:rgb(51,51,51);font-size:12px;white-space:pre-wrap">)</span>` for Bool class. Because sometime when you're processing JSON/XML it can help you a lot.</div><div><br></div><div>Examples:</div><div><br></div><div><pre style="padding:0px;color:rgb(51,51,51);overflow:auto;font-size:12px;margin-top:0px;margin-bottom:0px;white-space:pre-wrap;max-height:30em">Bool(<span style="color:rgb(0,145,0)">"<span>true</span>"</span>) -> <span style="color:rgb(0,0,145)">true</span>
Bool(<span style="color:rgb(0,145,0)">"<span>false</span>"</span>) -> <span style="color:rgb(0,0,145)">false</span>
Bool(<span style="color:rgb(0,145,0)">"TrUE"</span>) -> <span style="color:rgb(0,0,145)">true</span>
Bool(<span style="color:rgb(0,145,0)">" <span>true</span> "</span>) -> nil
Bool(<span style="color:rgb(0,145,0)">"1"</span>) -> nil
Bool(<span style="color:rgb(0,145,0)">"Y"</span>) -> nil
Bool(<span style="color:rgb(0,145,0)">"whatever"</span>) -> nil </pre><pre style="padding:0px;color:rgb(51,51,51);overflow:auto;font-size:12px;margin-top:0px;margin-bottom:0px;white-space:pre-wrap;max-height:30em"><br></pre><pre style="padding:0px;color:rgb(51,51,51);overflow:auto;font-size:12px;margin-top:0px;margin-bottom:0px;white-space:pre-wrap;max-height:30em"><br></pre></div>via <a href="https://bugs.swift.org/browse/SR-1282" target="_blank">https://bugs.swift.org/browse/SR-1282</a><div><br></div><div>Thanks.</div></div>
</div></blockquote></div>