I have a case in my app to load strings in runtime based on a flag. And I do not want to make code untidy by adding switch cases in the ViewControllers.
So, thinking about writing some thing like the following
Button(ButtonTexts.title) {
}
_______________________________________
enum ButtonTexts {
static var title = Variant.title
static var Id = Variant.id
}
*expecting Variant to take a value based on flag*
enum Button1 {
static var title = "Button1 title"
static var id = "button1"
}
enum Button2 {
static var title = "Button2 title"
static var accessid = "button2 access"
}
enum Button3 {
static var title = "Button3 title"
}
I donot want to define title in protocol because every enum will not have common variables. Also
from Controller's side I just want to call ButtonTexts.title
Please suggest some elegant ways of handling this. Thanks.