First of all, let me just go out and say that this new error handling system in Swift is a huge, huge improvement. However, this is one case that I'm unsure about, which is when you legitimately care about errors. However, sometimes you don't care about the specific error, but you just want to know if something succeeds or not. A good example is checking the availability of a file, where you just want to know if it's reachable and don't want to bomb out if it's not. In Objective-C, this would be done with one line of code, simply by passing NULL for the error parameter:
BOOL isReachable = [someURL.checkResourceIsReachableAndReturnError: NULL];
However, in Swift 2, the best way I can see to do this is:
let someURL = ...
let isReachable: Bool
do {
try someURL.checkResourceIsReachableAndReturnError()
isReachable = true
} catch {
isReachable = false
}
This seems somewhat verbose and awkward. Is there any more elegant way just to check if a file is reachable without treating the result as an error?