Skip to content

Instantly share code, notes, and snippets.

@listrophy
Last active August 29, 2015 14:23
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 listrophy/2270d5525ad3605042cf to your computer and use it in GitHub Desktop.
Save listrophy/2270d5525ad3605042cf to your computer and use it in GitHub Desktop.
if-let => try
func unwrap<T>(wrapped: T?) throws -> T {
guard let unwrapped = wrapped else {
throw NSError(domain: "custom", code: 1, userInfo: nil)
}
return unwrapped
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment