Prerequisite Information
Hello,
I have a macOS app which is split between two views each having it's own rows/cells .
You can click a row in the first view and it opens a view with more rows in the second view.
I have a custom view struct, which is a button saving and receiving data from Core Data, that depending on which of the two views you call it, it has a stage, and changes colour.
The relationship between them is, a row from the first view, has multiple rows from the second view. (This applies for both the views and the Core Data entities)
What should be happening:
First view button
Normally, when you press the button on the first view, it should update the Core Data value and change it's colour. Then it should update all of the stage values of all it's rows in the second view in Core Data, and then refresh the second view so their buttons reflect the changes in Core Data.
Second view button
When you press the button in the second view, it should update it's stage value in Core Data, change it's colour, and then update the value of it's parent view in Core Data and refresh to update it's colour.
What is happening now:
What is happening now, is that it correctly updates the stages in Core Data, and also applies the correct colours on the buttons when the app initializes, but when you press the button on either the first or the second view, it only changes the colour of the button pressed. It does not refresh the other view, so it reflects the value in Core Data.
I tried adding a binding variable that i would change when the button was clicked, without results. I also tried manually changing the values in the view model, but again no success.
How could I make this work?