I wanted to add the counter on how many times the activity was completed. But the button I created in ActivityView does not work because of the error "cannot use mutating member on immutable value: self is immutable"
Why is my Activity immutable? How should I increment the counter?
You are trying to mutate the
Here is a brief note from Paul.
Normally with an @State the declaration would be
However, since you are calling the
Hi, thanks for the pointer.
The Button woks now, of course the state is not preserved after I leave the detail view. Now I feel like I have to move away from passing a struct to the detail view, since I want to change it and preserve the change.
So instead of
I shall find out the index of the item the user touches (to go to the
Thank you for participating in my thinking process
SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.