Skip to content

Instantly share code, notes, and snippets.

@dennda
Created June 10, 2014 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennda/9cab1de2816080839953 to your computer and use it in GitHub Desktop.
Save dennda/9cab1de2816080839953 to your computer and use it in GitHub Desktop.
func nilAndPrintError<T>(errorMessage: String) -> T? {
println(errorMessage)
return nil
}
// usage:
func myFunc() -> SomeType? {
return nilAndPrintError("myFunc failed, O the embarrassment!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment