I have such enums:
enum Gender {
case male
case female
func toString() -> String {
switch self {
case .male:
return R.string.localizable.male()
case .female:
return R.string.localizable.female()
}
}
}
enum Relationship {
case mother
case father
case son
case daughter
case brother
case sister
case grandmother
case grandfather
case grandson
case granddaugther
case aunt
case uncle
case cousin
case stepsister
case stepbrother
case grandgrandmother
case grandgrandfather
case other
}
Is there easier way to get enum string values localized? For small enum like first this is not a problem but for longer as second one this ads many more lines to code.
Maybe there is some easier way to create localizable string description in such case?
I've tried also:
enum Gender: String {
case male = R.string.localizable.male()
case female
}
but this makes compiler error (it needs plain literal here)