Closed
Description
Hello there! 🖖
I've found the explicitly specifying an enum's name is too boilerplate. So can u please add "shorter dot" syntax sugar?
Example:
enum CompassPoint {
case north
case south
case east
case west
}
var directionToHead = CompassPoint.west
The type of directionToHead
is inferred when it’s initialized with one of the possible values of CompassPoint. Once directionToHead
is declared as a CompassPoint
, you can set it to a different CompassPoint
value using a shorter dot syntax:
directionToHead = .east
The type of directionToHead
is already known, and so you can drop the type when setting its value. This makes for highly readable code when working with explicitly typed enumeration values.
if directionToHead == .east { doSomething() }