Swift idiomatic error checking
问题 Let's say that you have a function like this: func getSomething(error: NSErrorPointer) -> Something and you typically use it this way: var error : NSError? = nil let a = getSomething(&error) What is an idiomatic way to check for error here? More specific questions: If error == nil can we assume that a will never be nil and vice versa? What should we check first: error (for its nilness) or a (to confirm that it's not a nil)? Can a != nil && error != nil be true in some cases? Thank you! 回答1: