I have an enum
type that extends String
in Swift.
When I try to use a switch
I got an error:
Case label in a switch should have at least one executable statement
Here is my code:
enum UserInfosKey:String {
case CameraMyPhotoStream = "CMPS"
case CameraICloudActivated = "CICA"
case CameraICloudShare = "CICS"
case ProjectTodayExtension = "PTE"
case ProjectShareExtension = "PSE"
case NetworkConnection = "NC"
case PhoneLanguage = "PL"
case CameraPhotosCount = "CPC"
case UserIdentifier = "UI"
case VersionHistory = "VH"
case Path = "Path"
}
class UserInfosController: NSObject {
func update(key:UserInfosKey, value:String, context:UserDefaultsMainKeys) -> String {
switch key {
case .CameraICloudActivated:
case .CameraICloudShare:
case .CameraMyPhotoStream:
case .CameraPhotosCount:
case .NetworkConnection:
case .PhoneLanguage:
case .UserIdentifier:
return value
default:
return ""
}
}
}
I'm pretty sure it's a simple mistake, anyone see it?
case .value1, .value2:
. I forgot it, but this was in ebook first chapters. (I'll accept this answer asap) – Aorist