Closed Jaime97 closed 4 years ago
Hello again,
Could you please help me with this? I am stuck in this development and I don't know how to proceed.
Thanks again.
@Jaime97 Hey!
The domain and the feature modules can communicate with each other in the mpp-library module which all other modules are connected to. So, you need to declare some use-case interface in the feature module and implement it somewhere in the mpp-library.
Here is the example: we have some interface in the feature: https://github.com/icerockdev/moko-template/blob/master/mpp-library/feature/config/src/commonMain/kotlin/org/example/library/feature/config/model/ConfigStore.kt which are injected to the feature factory constructor https://github.com/icerockdev/moko-template/blob/master/mpp-library/feature/config/src/commonMain/kotlin/org/example/library/feature/config/di/ConfigFactory.kt#L12. And the interface is implemented in mpp-library using domain module objects: https://github.com/icerockdev/moko-template/blob/master/mpp-library/src/commonMain/kotlin/org/example/library/SharedFactory.kt#L55.
@Tetraquark Hello!
A pretty good example, I've understood it perfectly now and I've been able to implement it.
Thanks!
Hello! As I have done before, I've opened this issue to ask a question: I don't really know right now how the domain and the feature modules communicate with each other. I have created a class
ExampleUseCase
and I want to call it somehow from a ViewModel and get a result from it. However, I can't refer to that use case from the ViewModel context (although I have seen I can do it from the android-app module), so clearly I'm missing something. I've also read the README of the project to try to get an idea and it says:But I don't really understand how. Can you help me with it?
Many thanks