Created
February 16, 2022 15:00
-
-
Save AlexChekel1337/a3aa8a07d4ebeb526c382d3b48780177 to your computer and use it in GitHub Desktop.
Swift Result
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
extension Result where Success == Void { | |
static var success: Result<Success, Failure> { | |
return .success(()) | |
} | |
} | |
// Example usage | |
func someFunctionThatReturnsResult() -> Result<Void, Error> { | |
// Allows to use just `.success` instead of `.success(())` | |
return .success | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment