Specific error values can be handled when switching over a Result
Sunday, 12 April 2020
When switching on a result, you can check for a specific error in the failure case to handle it differently from all other errors.
switch result {
case .success:
authDelegate.signInSuccess()
case .failure(AuthError.actionCancelled):
authDelegate.signInCancelled()
case .failure(let error):
authDelegate.signInFailed(with: error)
}