I have a simple enum of type string:
enum MyEnum: String {
case hello = "hello"
case world = "world"
}
And I want to write a case-insensitive constructor. I tried this (with or without extension):
init?(string: String) {
return self.init(rawValue: string.lowercased())
}
but I get an error saying:
'nil' is the only value permitted in an initializer