When working in ObjC, I can just jump to FoundationErrors.h and look through the possible errors I can get.
In Swift, it seems I have to go to the:
Right click, and jump to definition. Then I can select Foudation from the pop up menu in the path bar. Now I'm there. But there's no pop up menu to filter through symbols. So I have to scroll through a sea of stuff to get to what I'm looking for, which is potential errors to handle using the NSURL getResourceValue:forKey: method.
Is there a better way? I may just be a creature of habit, but I find it nice to jump to a header of documentation to see what type of errors are possible, get an error from a parameter that is easily readable from the method signature, and check the error "code" for the type. It feels easy.
The do try catch catch catch thing, just know to place an CocoaError.fileNoSuchFile here feels weird. Does it get better with time? Could there be a way to annotate methods that "throws" with a specific "ErrorType" struct or domain or whatever it's called in Swift, and then when you use that method, code completion will auto fill the do-do catch catch?
//Insted of this: getResourceValue(_ value: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKey key: URLResourceKey) throws //Maybe something like this: getResourceValue(_ value: AutoreleasingUnsafeMutablePointer<AnyObject?>, forKey key: URLResourceKey) throws CocoaError
Though, there are so many keywords and annotation requirements already in Swift, maybe adding another one isn't such a good idea?
Would the code read nicer, if you just returned multiple types, with one of those types being an "error", or nil for "no error" to avoid 3 or more code blocks?