Created
August 31, 2020 06:22
-
-
Save noppefoxwolf/621b8c8303c8dd1f3297567e29d1402d to your computer and use it in GitHub Desktop.
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 { | |
init(_ successValue: Success?, _ failureValue: Failure?) { | |
if let failureValue = failureValue { | |
self = .failure(failureValue) | |
} else if let successValue = successValue { | |
self = .success(successValue) | |
} else { | |
preconditionFailure() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment