Swift enumeration cases are defined as case someName, not case .someName.
This is an easy syntax error when declaring a new enum’s cases, as in most other situations you will be typing .someName via dot syntax. But when first declaring that enum case, it’s case someName without the period.
enum SomeEnum {
case one
case two
var otherCase: Self {
switch self {
case .one: return .two
case .two: return .one
}
}
}
1
solved Swift enum: “Extraneous ‘.’ in enum ‘case’ declaration” [closed]