I have the following implementation where potentially I could able to get two different error types as CustomError and ClassError.
However if I receive a ClassError, it goes into switch statement of CustomError's default case. I am wondering how to handle this scenario.
switch completion {
case .failure (let error):
switch error as? CustomError {
case .cFailed:
// show alert here
case .nFailed:
// show alert here
default:
// show alert here
}
switch error as? ClassError {
case .gFailed:
// show alert here
default:
// show alert here
}
return
}