Is it possible to use a reserved keyword as enum case?
For example:
enum MyEnum {
case Self // compiler complains here
case AnotherCase
}
From the Swift Language Guide (Naming Constants & Variables section)
If you need to give a constant or variable the same name as a reserved Swift keyword, surround the keyword with back ticks (`) when using it as a name. However, avoid using keywords as names unless you have absolutely no choice.
enum MyEnum {
case `Self`
case AnotherCase
}
and use it with or without backticks
let x: MyEnum = .Self
let y = MyEnum.`Self`