I'm dealing with enum and subclassing in Swift. Each child bring its own new properties which have to be stored in an Enum. This enum is declared with some values in the mother class. I'd like to add some value to this enum. I can't find out how to do it, I tried this without result :
extension MotherClass {
enum Enumeration {
case NewProperty
}
}
The only way to add items to an enum
is to add them directly to its declaration. You cannot add more items to an enum
through inheritance or any other extension mechanism: the enum
must be fully defined at the point of its declaration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With