Comments (2)
Hi @jiqimaogou thanks for your feedback.
I think the most important concept is the separation between the ViewModel and Repository, which is present in all architectures. These are the main 2 blocks.
Specifically, the D-KMP Architecture is implementing the MVI pattern, which requires to organize the ViewModel in a certain way. The MVI pattern helps writing very simple code, but in order to do that you need to give a very neat structure.
The 4 elements in the KMPViewModel are simply:
- Events, called by the UI layer to perform actions
- StateProviders, called by the UI layer to get the state for each screen
- StateReducers, where we define all functions that make modifications to the state (they are always called by the Events)
- StateManager, this is the core class of the whole architecture. It provides a consistent mechanism to manage state initializations and coroutine scopes.
The 6 files you mentioned:
Events.kt
KMPViewModel.kt
StateManager.kt
StateProviders.kt
StateReducers.kt
Repository.kt
stay the same for each app. There is not really anything to maintain.
What you personalize in the shared code of each app, is just:
- the 4 files (Events, State, StateProvider, StateReducers) in each screen folder in the ViewModel
- the functions, objects and sources in the DataLayer
Feel free to provide more specific feedback on which further simplifications you think could be made.
from d-kmp-sample.
ok, thank you. I think the answer is ok.
from d-kmp-sample.
Related Issues (20)
- Is there any way to achieve Android navigation transitions in this project? HOT 1
- Navigation appears to be broken on iOS HOT 7
- Error SockeTimeout when building `shared:runCommonizer` task HOT 5
- Yup
- Some doubts HOT 2
- Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel HOT 1
- First run not working HOT 1
- slowness in opening the project HOT 1
- Could not resolve ktor-client-js HOT 1
- Bad Gateway trying to get compose runtime HOT 2
- Result from other view/state HOT 1
- Ios could not see getIosInstance() HOT 2
- "Jvm target compatibility should be set to the same Java version" build error HOT 1
- Add composeApp/build folder to .gitignore HOT 1
- only one AppState may make performance issue? HOT 2
- FAILURE: Build failed with an exception. HOT 4
- App not working for android < 26. HOT 5
- iOS Native App HOT 10
- [Question] Architecture and implementation details HOT 1
- [Deprecated] Remove jcenter HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d-kmp-sample.