Sharing model between multiple view models - best practices
Posted: 04 Nov 2021, 06:09
I have a piece of shared state from our engine (resource manager, etc) that I would like to be accessible from multiple view models. Currently we are creating the view models from the view, as is described in all of the samples. Since the view model is created from the view, I can't pass state through to its constructor (since the view doesn't know this piece of state either - and I'm guessing it shouldn't). What is best practice for getting this shared state in to the view model? Before someone suggests it: singletons are not an option ;)
Any help appreciated!
Any help appreciated!