I am attempting to use swift export, with a module...
# swift-export
t
I am attempting to use swift export, with a module that uses Ktor. I am getting an error because some code has a member called 'description'. Tried the latest Kotlin 2.4.0-Beta2 and the same issue. Is there a way to define the module in gradle so that Ktor is not even exposed to the iOS side. I have everything wrapped in a way that the iOS side should not need anything from Ktor. Thanks!
f
Hi, I guess you let everyhing public in your module ? try to use explicitApi() Gradle rule to control the visibility of your code
t
mmm, never used that before. looking...
f
it’s just a rule to explicitly expose your code to the consumer
s
Are you using api(…ktor) or implementation(…ktor) in your Gradle file? https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_recognizing_dependencies
t
implementation in commonMain for all ktor modules, and implementation for darwin in iosMain
f
Everything public in your imported module is exposed to iOS
t
mmm
t
Found some of my issue. I have multiple modules, one depending on the other, and one exposes koin or Ktor types, which then cause all of that to be exported. And I cannot make them internal or they are not visible cross module. So perhaps one large module with tighter control on internal and public is a better way to go?
a
Hello there, thanks for the report 🙂 As Rick mentioned already - this(the original report) is a known problem that was fixed already in 2.4.20 dev builds.
Is there a way to define the module in gradle so that Ktor is not even exposed to the iOS side
This is also a known request, please follow https://youtrack.jetbrains.com/issue/KT-85687 🙂
Are you using api(…ktor) or implementation(…ktor) in your Gradle file?
These part of DSL have no impact on the export feature of kotlin compiler - neither Objective-C export nor Swift Export relies on those.
And I cannot make them internal or they are not visible cross module
Does
@HiddenFromObjectiveC
solves your current problem? https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.native/-hidden-from-obj-c/
t
Okay the @HiddenFromObjC was the key I was missing to clean up the exported Object-C header. Now I will try the Swift Export again.
kodee intensifies 1