Noob question on multiplatform expect and actual syntax rules


I am trying to determine if multiplatform will allow me to achieve my goal of 1 common library usable by Android & IOS (and eventually js hopefully) but cannot find much in the way of documentation on expect/actual syntax and usage rules

I have built the IOS Android tutorial and am now trying to retrofit my MVP Interface structure into it to see if it will work the way I envision

I have a series of Interfaces in more or less standard MVP pattern for Android with View interfaces and Presenter interfaces, etc. The presenter interfaces will be defined and the classes implementing them in kotlin in the shared code common src directory, the View interfaces will be invoked by the presenter to call back to either the Android Activity or the IOS ViewController classes to display the results on screen, as per the intent of multiplatform as far as I can tell.

But my interfaces are collections of abstract functions, I am not allowed to put the expect keyword on a member function, just a top level function or at the class or interface level.
On the platform specific side I can put the actual keyword on a member function but it does not have an expect to match with.

I need to put expect on my Interface definition (which encompasses all the methods for it i would assume), and then the platform specific actual is really the Android or IOS view Class that implements that common View interface (not an interface itself) … So when a common presenter method is executing , a call to the view.method() triggers the actual method on the view class for the platform it is running on

I am also not too clear on what if any impact there might be since my interface definition structure (which is nested) would be translated into an ios framework when swift (although i gather the framework is objc) does not allow for nested protocols.

any similar experiences or guidance would be appreciated, thanks


So not sure exactly what part of multiplatform code use facilitation the expect/actual construct supplies that I am misunderstanding perhaps, but I tried the following

I just defined my interfaces (nested like they were when I first defined them in java in Android Studio) in kotlin in the commonMain/kotlin subdirectory in the SharedCode module and a Presenter class that implements the applicable interfaces. I have nothing in the androidMain or iosMain subdirectories relating to these interfaces or classes.

then built the libraries as per the gradle scripts, then defined activity and view controller classes that implemented the view interfaces as per usual on the android and ios sides (within idea for the android app and in xcode for the ios app). And when i instantiate a presenter from a view and call the presenter method it executes the common code and then properly calls the result generating view method on whatever platform I am running on.

So it all works exactly how I would want it to work and I never used expect/actual at all. I am just using the capabilities of multiplatform to auto build via gradle a usable library for either platform. I guess I am wondering if eventual release of non-experimental multiplatform might alter this working behaviour, but I don’t see why it would at this point.

and what the framework generator did with my nested interface names was to just concatenate them all together for access from swift, the same way i did it myself when manually testing the implementation of my MVP hierarchical interface structure in swift. Sp Mvp.UpstreamActions.Presenter was accessible from swift as MvpUpstreamActionsPresenter