Join Slack
Powered by
I’m new to iOS and Kotlin Multiplatform. My Corout...
# multiplatform
z
Zsolt.bertalan
12/09/2021, 11:22 AM
I’m new to iOS and Kotlin Multiplatform. My Coroutine skills are not great yet either. I have a little app with Android and iOS targets here:
https://bitbucket.org/herrbert74_szinti/funquiz/src/main/
I tried to add a use case with a suspended function to the shared code. The function will later use the network, for now it’s only a delay function:
https://bitbucket.org/herrbert74_szinti/funquiz/src/main/shared/src/commonMain/kotlin/com/babestudios/shared/domain/usecase/game/InitGameUseCase.kt
Now, I want to use it in a ViewModel on the iOS side, but whatever I try, the whole class is frozen (I think). It fails with an InvalidMutabilityException, when I try to mutate the GameState. It happens here:
https://bitbucket.org/herrbert74_szinti/funquiz/src/main/iosApp/FunQuiz/Features/Game/GameViewModel.swift
What can I do to avoid freezing the state? Can I prevent the freezing or can I copy the state somehow into a mutable version?
Open in Slack
Previous
Next