At the moment, I am getting the following errors when attempting to run the following code: enum case good not found in type Situation? and enum case bad not found in type Situation?
enum Situation: Error {
case good
case bad
}
class SituationHandler {
var situation: Situation!
static let shared = SituationHandler()
}
class Scenario {
func handleScenario() {
let situation = SituationHandler.shared.situation
switch situation {
case .good:
print("All good")
case .bad:
print("All bad")
}
}
}
If I am using the situation on the SituationHandler as a Implicitly Unwrapped Optional, shouldn't I not receive this complaint? What am I doing wrong?
Thanks for the help to everyone who answers this.