daniaviladomingo / kmm Goto Github PK
View Code? Open in Web Editor NEWRick & Morty Kotlin/Compose Multiplatform: Ktor, Sqldelight, Koin, Flow, MVI, Compose
Rick & Morty Kotlin/Compose Multiplatform: Ktor, Sqldelight, Koin, Flow, MVI, Compose
I get this when I run the web app:
java.lang.IllegalArgumentException: Cross module dependency resolution failed due to signature 'org.w3c.dom.events/EventListener|2833721539368120484[0]' redefinition
at org.jetbrains.kotlin.ir.backend.js.transformers.irToJs
Hey,
I really like what you have done here. I'm new to KMM and have taken some inspiration from this project. Unless I'm misunderstanding a few things (Never used Koin before), this shared "BaseViewModel" doesn't survive config changes. I.e. it's making network requests upon rotation, lanugage changes and light/dark mode.
I had a little play with it and managed to let it survive config changes by introduction Android ViewModel on the android platform side by adding:
expect open class OSViewModel()
in commonMain
`import androidx.lifecycle.ViewModel
actual open class OSViewModel : ViewModel()
in androidMain
actual open class OSViewModel
in iOSMain
androidx.lifecycle:lifecycle-viewmodel-ktx
depedency in the build.gradle.kts::shared androidMain
private val vm: HomeViewModel by viewModels()
in the activities instead of Koin inject()
abstract class MainIoExecutor : OSViewModel()
in commonMain IOExecutor
By doing this, the Viewmodel is still shared, but on the Android platform, it takes the logic of the Android ViewModel to survive config changes. Again, this might not be necessary as I have misunderstood something but it seems to work nicely on my project.
Hello, thanks for sharing your project!
I just did a try to build it ad see some issues with that. For Android everything works perfectly. But for iOS I have some issues with that. Actually I am an Android developer so maybe I am missing something. This is what I have:
Seems like in my iOS project it does not see the shared module. Maybe I miss some command for linking the module to the iOS?
Thanks in advanced.
I want to thank you first,
then I hope you answer my question, it is a question, not an issue ๐
All ApiService methods are returning suspend functions
operator fun invoke(param: IN): Flow<Resource> = flow {
why are UseCaseIn methods converted to flowOf ()
e.g
abstract class UseCaseIn<IN> {
operator fun invoke(param: IN): Flow<Resource<Unit>> = flow {
emit(
try {
Resource.Success(block(param))
} catch (ex: Exception) {
Resource.Error(exception = ex)
}
)
}
protected abstract val block: suspend (param: IN) -> Unit
}
what are the benefits of making all repo methods in kotlin flow,
where consuming suspend fun is easier than flow?
also combing two suspend funs is much easier to combine two flows to create new use cases.
I see this pattern I would like to know the secret behind ๐
Hello again,
I almost study each GitHub KMM sample your's is the best.
I have a question if you plz.
private val _event: MutableSharedFlow<Event> = MutableSharedFlow()
val event = _event.asSharedFlow()
private val _effect: Channel<Effect> = Channel()
val effect = _effect.receiveAsFlow()
what is the clear difference between effects and events?
and why events are MutableSharedFlow where _effect is Channel
Hello again can you answer this please
https://stackoverflow.com/questions/74432336/how-to-handle-textfield-changes-in-mvi-faster
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.