I have a Localizable.strings with all the text I need. Example:
"Welcome": "Hello there, welcome!!";
To not misspeal the LocalizedStringKey "Welcome" in many parts of the app I created an enum like this:
enum LocalizableKey: LocalizedStringKey {
case welcome = "Welcome"
case interpolationCase = "Interpolation case %@ etc etc"
}
In SwiftUI it works if I use Text(LocalizableKey.welcome.rawValue)
.
My question is how can I interpolate a string for the case of .interpolationCase where I want to add a parameter?
Text(LocalizableKey.interpolationCase.rawValue)
<- Add a parameter. Also is it possible to add an attributedString for the parameter to have a different color?
Let's discard the solution of separating the text like this:
Text(LocalizableKey.interpolationCase.rawValue)
+ Text(\(parameterValue))
+ Text(LocalizableKey.anothercase.rawValue)
Thank you in advance.