Created
January 11, 2019 15:54
-
-
Save jakubpetrik/b5f1515c0fef3f507689438fc4520fdc to your computer and use it in GitHub Desktop.
Convert throwable to bool
This file contains hidden or 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 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