I have a struct like this
struct MyStruct {
var name : String?
var address : String?
var affiliated : Bool?
}
and then an array of MyStruct
var myArray : [MyStruct]? ...
As soon as I create an array of MyStruct every element inside that array is non-mutating, right?
The problem is that at some point I have to scan that array and update a field of all elements, like updating affiliated for every element of myArray and this update is asynchronous.
This is my problem. All elements inside myArray are not mutating.
The way I would solve that was by recreating every MyStruct element with the new value for affiliated, recreating myArray and replacing the old array with this new one.
It seems a dumb method, a waste of time and effort.
Is there a better way to do this?