https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
v

Vivek Modi

04/15/2022, 1:59 PM
Hey guys i am trying to communicate between kmm module and application. I tried to implement interface. In androidMain
Copy code
actual class Platform actual constructor() {
     actual val versionCode = AppConfig.versionCode
}

interface AppConfig {
    val versionCode: String
}
But I am getting error
g

Grégory Lureau

04/15/2022, 2:08 PM
AppConfig
refers to the interface, not an implementation. So you're trying to access the value of an interface (and you should retrieve value from an instance of a class).
v

Vivek Modi

04/15/2022, 2:09 PM
So how can I fix that?
okk sure thanks
g

Grégory Lureau

04/15/2022, 2:13 PM
Here I've no idea what you're trying to achieve exactly. Creating a new KMP project from IntelliJ already have a expect/actual example very similar to your example.
v

Vivek Modi

04/15/2022, 2:14 PM
okk
j

James Black

04/16/2022, 6:24 AM
Probably the best example across different applications is John O'Reilly, so look through his repo and it may help you understand more. https://github.com/joreilly
3 Views