Is it possible to use a reserved keyword as enum case?
For example:
enum MyEnum {
case Self // compiler complains here
case AnotherCase
}
In other languages this is possible by escaping the keyword in some ways, for instance in scala we use backticks, e.g.
`type`
can be used as identifier, despite type
being a reserved keyword.
Is there anything similar in swift?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…