I would like to have a shared property between my ...
# android
l
I would like to have a shared property between my custom view model/presenter classes, so my first idea was this:
Copy code
interface MyPresenter {
    companion object {
        val sharedState by mutableStateOf<MyState>(MyState.Initial)
    }
}
But the state can be modified from everywhere. Is there a possibility to restrict the access to only classes that implement this interface or is there a better solution for this. Another solution could be to create a shared vm/presenter and make it a dependency of my presenter classes but I'm not sure if it's common to compose view models/presenter, especially in terms of testing