Regardless if I use a protocol or not that contains this method, e.g. I have this
var test: String?
func setupData() -> Void {
test = "New value"
}
Why does it say
Cannot assign to property: 'self' is immutable"
So if i add mutable to setupData() which becomes "mutating func setupData() { ... }", then i get another error message
Cannot use mutating member on immutable value: 'self' is immutable
I call setupData in onAppear() instead of init() for now. Putting it in init forces me to initialize the variables (sucks)
I am lost on this one. Advise?
This is used inside a Struct View. not a class.