Skip to content

Instantly share code, notes, and snippets.

@jakubpetrik
Created January 11, 2019 15:54
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 jakubpetrik/b5f1515c0fef3f507689438fc4520fdc to your computer and use it in GitHub Desktop.
Save jakubpetrik/b5f1515c0fef3f507689438fc4520fdc to your computer and use it in GitHub Desktop.
Convert throwable to bool
func boolify(_ throwable: () throws -> Void) -> Bool {
var success = true
do {
_ = try throwable()
} catch {
success = false
}
return success
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment