I have an array :
struct Main: Identifiable {
var id = UUID()
var value: String
var type: String
}
var mainArray = [Main]()
And I need to output the "var value" of each of the elements which are in this array into a Text("")
Like : Text("(main[index].value)")
But I don't know the correct way of doing that
Also, I wiil need to be able to tweak the value I get with a function like :
func readMain() -> String {
if main[index].value == "specificContent" { return "Correct" }
else { return "Incorrect"}
}
And then add my Text(readMain()) but that return all the values from the array like :
Text("Correct, Incorrect, Incorrect, Correct, Correct")
Any idea ?
Thanks in advance !