I searched a lot of questions here, I found one with a similar name. The Case Enum switch was not found in the type , but there is no solution for me.
I would like to use the enumeration with the mutation itself to solve the question of what is the next color of the traffic light in individual states.
enum TrafficLights { mutating func next() { switch self { case .red: self = .green case .orange: self = .red case .green: self = .orange case .none: self = .orange } } }
I put all cases as possible options and still return an error:
Enum "case" not found in type "TrafficLights"
enums switch-statement swift
Giorgioe
source share