Why it is not possible to expect only parts of a class in a multiplatform project?


Well, why?


I strongly believe it is possible. When I remember correctly I used to do this in my project.

class Test {

    expect fun test(){  <-- "Modifier 'expect' is not applicable to 'member function'"




Try putting expect on the class declaration also: expect class Test. And the expected method must not have a body.


the other way around!

expect class Test {

    fun test(){  <-- "Expected declaration must not have a body"




Now I see what you are trying to do. You are trying to put non-expected declarations into an expected class. My first understanding was that you want to put additional functions into the actual class.

Yeah, what you are trying to do might not be possible. The best thing to do is extracting an interface with default functions in it.