Reputation: 396
I'm facing an error says "cannot assign to property" as seen in the preview image.
I get this error when I use the variable inside the struct of View and inside the forEach.
Upvotes: 9
Views: 12513
Reputation: 299683
Define your currentMood
as a @State
variable:
@State var currentMood: String
You'll likely need to assign it with self.currentMood = moodData
(adding self.
)
Upvotes: 24