I have an enum in objective-c
typedef enum {
status1,
status2,
} BattStatus;
@property (nonatomic) BattStatus batStatus;
To use it in swift, I'm doing:
switch (MySingleton.sharedInstance().batStatus){
case status1: break
case status2: break
default: break
}
It gives me error: BattStatus does not conforms to protocol 'IntervalType'. On line case status1: break
I cannot edit the first objective-c Singleton class yet. Just have to use it for now.
Objective-C enum declarations are only imported as Swift enums if the NS_ENUM macro is used. You'll need to use the value property on any BattStatus instance to access its value for comparison.
You can read more here: C-Style "typedef enum" in Swift
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