I have a Struct model with 3 properties: Name Date Cost
I get a he first 2 properties data from a network request and I populate an array.
Within that same network request in order to get the 3rd properties data I have to make a separate network request.
Once I have pulled that data I loop using a for each over my array and do:
For post in posts { post.Cost = newCost -> this comes from network request }
The problem with this is I get errors that say I cannot mutate a let constant.
So I change the Struct properties to bar. Then I get a compiler error or it will run but the data is blank even though print statements show I’m getting the data from the network request. I need to understand how can I mutate an array of data that is decided into a model with multiple network requests giving me the data.
In Python this is easy and the way I do it here , I thought would translate to Swift but it is not.