Usage - Enum Exhaustiveness
val response = accountsApi.signup(with: "John Doe", and: "
[email protected]")
switch response {
case .accountCreated(let userId):
saveUserId(userId)
case .emailAlreadyRegistered(let registrationEmail):
showEmailAlreadyRegistered(registrationEmail)
case .inputValidationFailed(let errors):
showValidationErrors(errors)
case .connectionError:
showCheckConnectionMessage()
case .serverError(_),
.unknownError(_, _):
showTryAgainInSometimeMessage()
}