-[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:

func checkResourceIsReachable() throws -> Bool

All the documentation has to say about this is:

"This method is currently applicable only to URLs for file system resources. 
For other URL types, false is returned.”

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.

What’s the rationale behind this?

Charles



_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to