Hello, I’m setting up my LoginViewModel inside of ...
# multiplatform
b
Hello, I’m setting up my LoginViewModel inside of commonMain and trying to extend CoroutineViewModel which is inside of my appMain. Am I not supposed to do this?
g
Are you trying to import a class from iosMain to commonMain ? (hint: that should be the opposite direction) Where's defined your CoroutineViewModel class?
I didn’t have a appleMain, so I put it inside of iOSmain. He has an appleMain.
I think this is wrong, he is extending CoroutineViewModel from commonMain?
g
This repository use the expect/actual pattern, this is the "expect" shared class : https://github.com/halcyonmobile/MultiplatformPlayground/blob/master/common/src/co[…]cyonmobile/multiplatformplayground/shared/CoroutineViewModel.kt The "actual" part is defined on each stack. You can use the common class everywhere, but inside a stack (I mean android/iOS/...) you can only refers class that are from commonMain our iosMain.
b
thanks
g
b
what is this about
g
When you define 1
expect
in commonMain, you then have to define X
actual
for each of the platform you're using. (You should read the documentation and follow usage of the project you mentionned.)
b
Thanks