Relative Content

Tag Archive for swiftswiftuiobservablecombine

Combine function initialized outside of view

I have an Updater class that uses Combine to check a state then update another state. If I initialize the Updater in a view it works fine but it is initilized again each time the View is redrawn. If I initialize the Updater outside the View the Combine process isn’t called when the state updates, i.e. sink is only called one, not when firstCount is updated.