Can you inherit enum in Swift? What are the rules that one should be aware of with regards to enum inheritance?
The following test code:
enum TemperatureUnit: Int {
case Kelvin, Celcius, Farenheit
}
enum TemperatureSubunit : Temperature {
}
generates
error: type 'TemperatureSubunit' does not conform to protocol 'RawRepresentable'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…