-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
@objcFeature → attributes: The @objc attributeFeature → attributes: The @objc attributecompilerThe Swift compiler itselfThe Swift compiler itselfdeclarationsFeature: declarationsFeature: declarationsenumFeature → type declarations: Swift enumeration declarationsFeature → type declarations: Swift enumeration declarationsfeatureA feature request or implementationA feature request or implementationobjective-c interopFeature: Interoperability with Objective-CFeature: Interoperability with Objective-Craw-value typesFeature → declarations → enum: A raw-value type of an enumerationFeature → declarations → enum: A raw-value type of an enumeration
Description
@objc public enum TestEnum: Int {
case first = 1
case second = 2
var strValue:String {
switch self {
case .first:
return "first"
case .second:
return "second"
}
}
func getStrValue(_ value: TestEnum) -> String {
return value.strValue
}
If I am using on ObjC
NSLog(@"%@", getStrValue(3));
There are no error prompts during the compilation phase
Crash may occur during the operation phase
Can we detect and predict this error during the compilation phase, and prompt to add default in the Switch
Metadata
Metadata
Assignees
Labels
@objcFeature → attributes: The @objc attributeFeature → attributes: The @objc attributecompilerThe Swift compiler itselfThe Swift compiler itselfdeclarationsFeature: declarationsFeature: declarationsenumFeature → type declarations: Swift enumeration declarationsFeature → type declarations: Swift enumeration declarationsfeatureA feature request or implementationA feature request or implementationobjective-c interopFeature: Interoperability with Objective-CFeature: Interoperability with Objective-Craw-value typesFeature → declarations → enum: A raw-value type of an enumerationFeature → declarations → enum: A raw-value type of an enumeration