Change state from other struct

I have this code:

    static var viewModels = [RestaurantListViewModel]() {

        didSet {

            dataSet = true

            print("data set")

        }

    }

When it didSet is called, I want it to change a state in another struct, how can I accomplish this?

Accepted Reply

Decided to set this in the same struct and then pass it in as a parameter.

Replies

Can you provide a bit more information about how your code is structured? This should be possible, either through didSet or some other way.

  • It gets updated before the view is shown, I just need to wait to show the view until that array is set.

Add a Comment

Decided to set this in the same struct and then pass it in as a parameter.