After including ktor and trying to consume the cla...
# multiplatform
s
After including ktor and trying to consume the classes from
shared
project in a ios app, the app fails to start in simulator with error message:
Copy code
Can't show file for stack frame : <DBGLLDBStackFrame: 0x10bedffc0> - stackNumber:9 - name:objc2kotlin_kfun:com.bundleid.mobile.core.di.SharedDependencies#<init>(kotlin.String;com.bundleid.mobile.auth.AuthenticationProvider){}. The file path does not exist on the file system: /<compiler-generated>
It was possible to run the app without shared code beforehand. The project was generated from the wizard, with introducing some code afterwards. I am not sure this is related to ktor at all though, seems to me there is a general setup issue here, can't seem to find a solution elsewhere either, so hoping for assistance here. This might also be somewhat relevant but
AuthenticationProvider
is an interface defined in shared code but implemented on iOS side, workarounds i have considered, but not nailed is passing on a function instead of an object, but i would prefer to figure out the passing the object part. Question: Does anything that is crossing this
shared
<-> iOS boundary need some implementation like the Platform example has a
Platform.ios.kt
Update: found another error when returning to the problem, turns out an exception was being raised without the
@Throws
annotation
d
It's absolutely fine to have an interface defined in Kotlin and implemented on Swift.
Platform.ios.kt
does a similar thing but keeps the implementation in the Kotlin side too. It's more a personal preference than anything else whether you use expect/actual or go via Swift (although sometimes one could be easier than the other).
s
Thank you for the response, is there a specific benefit to providing an expect/actual implementation as well other than keeping the platform specific implementations wrapped on the shared layer?