Daniel Tull: Today I Learned

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:

case .failure(AuthError.actionCancelled):

case .failure(let error):
    authDelegate.signInFailed(with: error)