I'm trying to implement a enum for range of numbers. For example:
enum DoSomething: Int, Codable {
case one = 1
case two = 2
case three = 3
case other = 4..100
}
But on this case I get this error:
Raw value for enum case must be a literal
Any of you knows how can I implement the enum for a range of numbers?
or how can fix this error.
I'll really appreciate your help.
I came up with something like this
You can modify the cases to your liking of course plus you can init with a custom value, too.
Example usage: