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

oshai

02/12/2023, 7:26 AM
when having
expect interface
I understand the some platforms are expected to have an actual which is just an existing interface in another lib. But some platforms needs to provide the interface, which makes it just duplicating the same signature. For example in kotlin-logging I had an expected interface KLogger which in jvm was actually slf4j Logger. But then in other platforms I have to provide that actual interface by hand (no lib match that interface). I wonder if I am doing something wrong, or if there is a way to tell multiplatform to use the expected interface "as is"
v

Vojtěch Pešek

02/15/2023, 3:44 PM
I think that if you have
expect interface
, than you must provide
actuals
for each platform. I don't understand what you mean by
if there is a way to tell multiplatform to use the expected interface "as is"
You need to provide actual. Is it problem of having different but similar targets having the same
actual
, thus making you duplicate the code?
o

oshai

02/15/2023, 4:11 PM
Since it's an interface not impl, in many cases expected and actual is exactly the same
4 Views