<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="">One line above the text that you quoted, you can read:<div class=""><br class=""></div><div class=""><blockquote type="cite" class="">If this method returns&nbsp;false, the object pointer referenced by&nbsp;error&nbsp;is populated with additional&nbsp;information.<br class=""></blockquote><div class=""><div class=""><div class=""><span style="orphans: 2; widows: 2;" class=""><br class=""></span></div><div class=""><span style="orphans: 2; widows: 2;" class="">The rationale is probably that this method was awkward to begin with. It's unclear to me why it was decided to return a `NSError` by reference and a bool that is seemingly equivalent to `error != nil`.</span></div><div class=""><span style="orphans: 2; widows: 2;" class=""><br class=""></span></div><div class=""><span style="orphans: 2; widows: 2;" class="">Félix</span></div>
<br class=""><div><blockquote type="cite" class=""><div class="">Le 7 août 2016 à 10:41:32, Charles Srstka via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</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="">-[NSURL checkResourceIsReachableAndReturnError:] has taken on several forms in Swift during its development, sometimes returning a Boolean and an error by reference, sometimes returning Void and using Swift’s do/try/catch system. In Swift 3, though, it appears to do both, which is weird:<div class=""><br class=""></div><div class=""><span class="syntax-keyword" style="box-sizing: inherit; color: rgb(170, 13, 145); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px;">func</span><span style="color: rgb(51, 51, 51); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px; background-color: rgb(249, 250, 250);" class="">&nbsp;</span><span class="syntax-identifier" style="box-sizing: inherit; font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px;">checkResourceIsReachable</span><span style="color: rgb(51, 51, 51); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px; background-color: rgb(249, 250, 250);" class="">()&nbsp;</span><span class="syntax-keyword" style="box-sizing: inherit; color: rgb(170, 13, 145); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px;">throws</span><span style="color: rgb(51, 51, 51); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px; background-color: rgb(249, 250, 250);" class="">&nbsp;-&gt;&nbsp;</span><span class="syntax-type" style="box-sizing: inherit; color: rgb(92, 38, 153); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px;">Bool</span></div><div class=""><span class="syntax-type" style="box-sizing: inherit; color: rgb(92, 38, 153); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px;"><br class=""></span></div><div class=""><span class="syntax-type" style="box-sizing: inherit; color: rgb(92, 38, 153); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px;"><span style="font-family: Helvetica; font-size: 12px; text-indent: 0px;" class="">All the documentation has to say about this is:</span></span></div><div class=""><span class="syntax-type" style="box-sizing: inherit; color: rgb(92, 38, 153); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px;"><span style="font-family: Helvetica; font-size: 12px; text-indent: 0px;" class=""><br class=""></span></span></div><div class=""><span class="syntax-type" style="box-sizing: inherit; color: rgb(92, 38, 153); font-family: Menlo, monospace; font-size: 14px; text-indent: -28.44451332092285px;"><span style="font-family: Helvetica; font-size: 12px; text-indent: 0px;" class="">"</span></span>This method is currently applicable only to URLs for file system resources. For other URL types, false is returned.”</div><div class=""><br class=""></div><div class="">It does not, however, say whether non-file URLs are the only thing that can cause a return of ‘false’, so I don’t know whether I should be checking the return value when checking a file URL or not. This results in having to check both the return value *and* the catch block each time, which is fairly awkward. I’m also not clear on why checking reachability on a non-file URL can’t just return an error like it did in the past.</div><div class=""><br class=""></div><div class="">What’s the rationale behind this?</div><div class=""><br class=""></div><div class="">Charles</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></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=""></div></div></div></body></html>