Enum in class in Swift
How do you access the enumeration of classes from outside the class?
class Element
{
enum Type
{
case AUDIO
case LIGHT
case THERMOSTAT
}
}
var a = Element.Type.LIGHT // error: 'Element.Type.Type' does not have a member named 'LIGHT'
var b = Element.LIGHT // error: 'Element.Type' does not have a member named 'LIGHT'
+3
source to share