How can I share variables between multiple interface controllers in a paged-based interface on watchOS

Viewed 795

I have multiple interface controllers that are both open at the same time in a paged-based format. I need to share information between these interface controllers.

For my use case, I cannot force the user to one of the other interface controllers (by initiating a segue), so the those solutions will not work for me. I need to be able to change some variables in either controller, and access those variables in either controller.

I tried directly setting a variable in an interface controller that is not currently visible in this way:

InterfaceController2().variable = false

But, this didn't work (as expected) since this is not accessing the currently instantiated instance of that interface controller.

I am considering some sort of global variable situation, or storing preferences in UserDefaults, but I feel like there must be a better way.

2 Answers
Related