Closed ldobransky closed 1 year ago
Hi! A couple questions to better understand your project:
LoginViewModel
part of the shared
Kotlin module, or is it part of another Kotlin module?viewModel
property defined in Swift?I have class
class LoginViewModel: shared.LoginViewModel { }
and then in view
@StateViewModel var viewModel = LoginViewModel()
Alright that looks good. Is this an open-source project, or could you share a reproduction project?
I found new info, there is conflict with moko resources library and ksp... so going try to solve this `Some problems were found with the configuration of task ':shared:kspKotlinIosX64' (type 'KspTaskNative').
Gradle detected a problem with the following location: '/Users/lukas.dobransky/Documents/Projects/game-tracker/shared/build/generated/moko/iosX64Main/src'.
Reason: Task ':shared:kspKotlinIosX64' uses this output of task ':shared:generateMRiosX64Main' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
Alright, I am unsure if that is related to the issue, but please do let me know if you have more details on how to reproduce the issue.
I think we should rename the ticket to something like add support with moko resources library, because when I want to use this library and moko resources there is a conflict what I sent above. When I removed moko from project, kmm-viewmodels start working. So I can edit the title of the issue. here is the link what I mean: https://github.com/icerockdev/moko-resources EDIT: it's beacuse that library is using this https://github.com/google/ksp/tree/master so I renamed the task to support KSP instead of resources library. Conflict is with KSP
I fixed the issue with that code, for another cpu types is need to add the same code: but it fixed the issue, maybe you can update readme, when somebody has issue with ksp, here is the solution:
afterEvaluate { tasks { val generateMRiosX64Main by getting val kspKotlinIosX64 by getting kspKotlinIosX64.dependsOn(generateMRiosX64Main) } }
Thanks for the update! Actually KMP-NativeCoroutines uses KSP, as far as I can tell moko-resources doesn't use KSP. Anyway looking at your fix the issues seems to be with moko-resources and KSP. Might be worth it to create an issue for moko-resources.
Hello I have in viewmodel variables like
private val _loginState = MutableStateFlow<LoginStatus>(viewModelScope, LoginStatus.NonAuthenticated) @NativeCoroutinesState val loginState = _loginState.asStateFlow()
but in iOS when I have created viewmodel I can't have access to this variable, functions are visible, calling that functions is working well. Can somebody help me where I have issue?