I want to associate two raw values to an enum instance (imagine an enum representing error types, I want
Error.Teapot
code
I'm a teapot
Teapot
code
Teapot
switch
self
No, an enum cannot have multiple raw values - it has to be a single value, implementing the Equatable
protocol, and be literal-convertible as described in the documentation.
I think the best approach in your case is to use the error code as raw value, and a property backed by a prepopulated static dictionary with the error code as key and the text as value.