As of Xcode 10.2, when using enums I've defined in Objective-C, but in a Swift 5 switch statement, I get the following warning, even if I've exhausted all the possible enum values.
Switch covers known cases, but 'MyObjectiveCEnumName' may have additional
unknown values
Xcode is telling me I should fix this by
Handle unknown values using "@unknown default"
Why is this happening and what can I do about it?
Example
Objective-C enum
typedef NS_ENUM(NSUInteger, CardColor) {
CardColorBlack,
CardColorRed
};
Swift 5 switch statement
var cardColor: CardColor = .black
switch (cardColor) {
case .black:
print("black")
case .red:
print("red")
}