<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="">-[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="color: rgb(0, 0, 0); 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="color: rgb(0, 0, 0); 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="color: rgb(0, 0, 0); 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></body></html>