[swift-dev] Swift C enum Case Mapping
Ryan Lovelett
swift-dev at ryan.lovelett.me
Sun Jan 10 15:06:53 CST 2016
I've successfully(?) imported C enum that is defined as:
typedef enum fe_type {
FE_QPSK,
FE_QAM,
FE_OFDM,
FE_ATSC
} fe_type_t;
I wanted this enum to conform to `CustomStringConvertible` so I added
the following extension:
extension fe_type: CustomStringConvertible {
var description: String {
switch self {
case .FE_QPSK: return "QPSK"
case .FE_QAM: return "QAM"
case .FE_OFDM: return "OFDM"
case .FE_ATSC: return "ATSC"
}
}
}
Unfortunately this does not compile successfully. The compiler states
that "enum case 'FE_QPSK' not found in type 'fe_type'" (and repeats for
all the cases). Does that mean that fe_type is _NOT_ an enum in Swift?
If it is how can I determine what Swift imported the case names as?
More information about the swift-dev
mailing list