SwiftUI: LocalizedStringKey with indices

Viewed 179

i have a Localizable.strings with following content:

"Question1"       = "blablabla";
"Question2"       = "blablablub";
"Question3"       = "bliblablub";

now I want to print my questions in a ForEach. But my following syntax doesn't work. How can I solve my problem?

  List(){
            ForEach (1..<4) { value in   
                Text(LocalizedStringKey("Question\(value)") )}
            }
1 Answers

Here is a solution. Tested with Xcode 12.1 / iOS 14.1

ForEach (1..<4) { value in
    Text(LocalizedStringKey(stringLiteral: "Question\(value)"))
}
Related