I am looking for pattern in swift to synchronize the state of multiple controls. Say I have NSSegmentedControl
in the view, NSMenuItem
s with checkmarks and NSSegmentedControl
in touch bar. Each of them is sending change to model. But how to synchronize with other two? I can use delegates but it looks like the complexity will grow with number of synchronizable items. Is there a common pattern to approach this problem? I would think of something like subscription to change, so all 3 controls can subscribe to it and receive notification when a change occurs, then use it's own transformation of data to pass to the control. Wonder if there is some mechanism for that.
mercredi 28 novembre 2018
How to synchronize multiple controls?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire