Created
September 24, 2017 11:45
-
-
Save RPallas92/27b0371389fc7ebbeafd76d007ceff8d to your computer and use it in GitHub Desktop.
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
//You can react to the validation result value, either it's a success or a failure | |
let success: Validation<String, Int> = Validation.Success(1) | |
switch(success){ | |
case .Success(let value): | |
print(value) | |
case .Failure(let error): | |
print(error) | |
} | |
// ==> Print(1) | |
let failure: Validation<String, Int> = Validation.Failure("error") | |
switch(failure){ | |
case .Success(let value): | |
print(value) | |
case .Failure(let error): | |
print(error) | |
} | |
// ==> Print("error") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment