Created
March 27, 2015 18:31
-
-
Save tapi/2d1479851b4b75eaf055 to your computer and use it in GitHub Desktop.
Wouldn't this work instead of a nil default?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSError{ | |
//... | |
class func | |
myParseError(description:String?="Parse failed.") -> NSError { | |
let info = [NSLocalizedDescriptionKey: description] | |
return self( | |
domain:myDomain, | |
code:MyErrorCodes.ParseError.rawValue, | |
userInfo:info) | |
} | |
} | |
// Original from http://www.figure.ink/blog/2015/3/21/clean-optional-parameters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment