How can I fix this error, while still keeping the value of the array the same? Here's a screenshot of my code:
CodePudding user response:
If I have understood correctly the question, and the problem... you have to set var group_array
as a property of the class.
This way you could access it in the Firestore function, and read it in body view.
CodePudding user response:
var group_array
is defined out of VStack
scope.
I suggest using @State
in order to store group_array
.
@State var group_array: Array
var body: some View {
....