Last active
August 29, 2015 14:23
-
-
Save listrophy/2270d5525ad3605042cf to your computer and use it in GitHub Desktop.
if-let => try
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
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