Hi all :wave:, I have a basic KMP project with an ...
# multiplatform
b
Hi all 👋, I have a basic KMP project with an android and ios app, and a "shared" module. The shared module has a dependency on Ktor for making http requests. I've noticed that when I'm working on my ios project in Xcode, I can "see" and have access to all of the Ktor classes and methods in the swift code. How can I "hide" Ktor from the ios project? It should only be used/called from the shared module.
m
In the binary section for the shared module iOS configuration, make sure you are not exporting KTOR and that you are not using transitive exporting. Some types might still get exported with poor names if those types are used in the public interface of the shared module.
Making heavy use of
internal
visibility in the shared module should reduce the types that need to be exported.
j
Also worth perhaps looking at using
explicitApi
mode
b
Thanks @Michael Krussel. I'm definitely not exporting KTOR in the swift binary. My setup is pretty basic:
Copy code
listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            isStatic = true
        }
    }
m
Then I thought it just exported out the type declaration and not the functions, but I guess I am wrong.
b
Yeah i thought so too. But I guess not.